Archive for 九月, 2011

命令行 mysql create procedure

下面是一个使用OUT参数的简单的存储程序的例子。例子为,在 程序被定义的时候,用mysql客户端delimiter命令来把语句定界符从 ;变为//。这就允许用在 程序体中的;定界符被传递到服务器而不是被mysql自己来解释。 (continue reading…)


multiple displayCond in TCA

How to use:
‘displayCond’ => ‘FIELD:sys_language_uid:IN:0,1,2&&FIELD:t_type:=:0||FIELD:sys_language_uid:=:0&&FIELD:t_type:=:1’,

t3lib/class.t3lib_tceforms.php

line 6092: isDisplayCondition()
(continue reading…)

1 Comment more...

Mysql InnoDB 之 ibdata1 瘦身大法

# 备份数据库:

/usr/local/mysql/bin/mysqldump -uDBuser -pPassword –quick –force –routines –add-drop-database –all-databases –add-drop-table > /data/bkup/mysqldump.sql

# 停止数据库

service mysqld stop (continue reading…)


MySQL服务器安装完之后如何调节性能

My favorite question during Interview for people to work as MySQL DBAs or be involved with MySQL Performance in some way is to ask them what should be tuned in MySQL Server straight after installation, assuming it was installed with default settings. (continue reading…)


proc/sys/net/ipv4/下各项的意义

tcp_syn_retries :INTEGER
默认值是5
对于一个新建连接,内核要发送多少个 SYN 连接请求才决定放弃。不应该大于255,默认值是5,对 应于180秒左右时间。(对于大负载而物理通信良好的网络而言,这个值偏高,可 修改为2.这个值仅仅是针对对外的连接,对进来的连接,是由tcp_retries1 决定的) (continue reading…)


“autoresize”插件自动改变textarea大小

The following options are available:

onResize – (type: Function) – A callback function fired every time the textarea is resized. Within the function ‘this’ refers to the textarea being resized.
animate – (type: Boolean) – If set to false no animation will take place, the height will immediately change when necessary. By default it’s set to true.
animateDuration – (type: Number) – Millisecond duration of animation, by default it’s set to 150. (continue reading…)


autoTextarea-文本框根据输入内容自适应高度

CSS代码:
JS代码,默认的参数及调用:
//默认的参数
$(“.chackTextarea-area”).autoTextarea({
maxHeight:220,//文本框是否自动撑高,默认:null,不自动撑高;如果自动撑高必须输入数值,该值作为文本框自动撑高的最大高度
minHeight:$(this).height()//默认最小高度,也就是文本框最初的高度,当内容高度小于这个高度的时候,文本以这个高度显示
}) (continue reading…)


PHP-CGI 进程 CPU 100% 与 file_get_contents 函数的关系

有时候,运行 Nginx、PHP-CGI(php-fpm) Web服务的 Linux 服务器,突然系统负载上升,使用 top 命令查看,很多 php-cgi 进程 CPU 使用率接近100%。后来,我通过跟踪发现,这类情况的出现,跟 PHP 的 file_get_contents() 函数有着密切的关系。 (continue reading…)


ab Connection reset by peer (104)

Try this :

echo “10240” > /proc/sys/net/core/somaxconn

or set (to make permanent)

net.core.somaxconn = 10240 (or any number over what you are using as max connections)

in

/etc/sysctl.conf

then run

/sbin/sysctl -p /etc/sysctl.conf

Also set your local ulimit to

ulimit -n 65535

just to have some overhead in case you want to increase the concurrent connections in ab. Let me know if that helps. If you want my thoughts on why I think this fixes things (assuming it helps you) let me know

Also if you move to Worker MPM (you will have to redo php to be threadsafe if you use php) it might lower you CPU usage for a higher RAM usage depending on what your running off your server.


查看Apache并发请求数及其TCP连接状态

这两天搭建了一组Apache服务器,每台服务器4G内存,采用的是prefork模式,一开始设置的连接数太少了,需要较长的时间去响应用户的请求,后来修改了一下Apache 2.0.59的配置文件httpd.conf: (continue reading…)


Copyright © 1996-2010 Add Lives. All rights reserved.
iDream theme by Templates Next | Powered by WordPress