7/12/2011

Apache tuning

http://www.devside.net/articles/apache-performance-tuning

Netstat : How to Find and Check Number of Connections to a Server

netstat -na
Display all active Internet connections to the servers and only established connections are included.

netstat -an grep :80 sort

Show only active Internet connections to the server at port 80 and sort the results. Useful in detecting single flood by allowing users to recognize many connections coming from one IP.

netstat -n -p|grep SYN_REC | wc -l
Let users know how many active SYNC_REC are occurring and happening on the server. The number should be pretty low, preferably less than 5. On DoS attack incident or mail bombed, the number can jump to twins. However, the value always depends on system, so a high value may be average in another server.

netstat -n -p | grep SYN_REC | sort -u
List out the all IP addresses involved instead of just count.

netstat -n -p | grep SYN_REC | awk '{print $5}' | awk -F: '{print $1}'
List all the unique IP addresses of the node that are sending SYN_REC connection status.

netstat -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n
Use netstat command to calculate and count the number of connections each IP address makes to the server.

netstat -anp |grep 'tcp\|udp' | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n
List count of number of connections the IPs are connected to the server using TCP or UDP protocol.

netstat -ntu | grep ESTAB | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -nr
Check on ESTABLISHED connections instead of all connections, and displays the connections count for each IP.

netstat -plan|grep :80|awk {'print $5'}|cut -d: -f 1|sort|uniq -c|sort -nk 1
Show and list IP address and its connection count that connect to port 80 on the server. Port 80 is used mainly by HTTP web page request.

netstat -nt | grep 80 | wc
find total connection

7/11/2011

Mysql :my.cnf Tuning

[mysqld]
user=mysql
bind-address=127.0.0.1
datadir=/var/lib/mysql
pid-file=/var/run/mysqld/mysqld.pid
socket=/var/run/mysql/mysql.sock
port=3306
tmpdir=/tmp
language=/usr/share/mysql/english
skip-external-locking

query_cache_limit=64M
query_cache_size=32M
query_cache_type=1

max_connections=15
max_user_connections=300
interactive_timeout=100
wait_timeout=100
connect_timeout=10

thread_stack=128K
thread_cache_size=128

myisam-recover=BACKUP

key_buffer=64M
join_buffer=1M
max_allowed_packet=32M
table_cache=512M
sort_buffer_size=1M
read_buffer_size=1M
read_rnd_buffer_size=768K
max_connect_errors=10
thread_concurrency=4

myisam_sort_buffer_size=32M
skip-locking
skip-bdb
expire_logs_days=10
max_binlog_size=100M
server-id=1

[mysql.server]
user=mysql
basedir=/usr

[safe_mysqld]
bind-address=127.0.0.1
err-log=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
open_files_limit=8192
SAFE_MYSQLD_OPTIONS=”–defaults-file=/etc/my.cnf –log-slow-queries=/var/log/slow-queries.log”

[mysql]
[isamchk]
key_buffer=64M
sort_buffer=64M
read_buffer=16M
write_buffer=16M

[myisamchk]
key_buffer=64M
sort_buffer=64M
read_buffer=16M
write_buffer=16M

[mysqlhotcopy]
interactive-timeout
max_heap_table_size = 64 M
tmp_table_size = 64 M
!includedir /etc/mysql/conf.d/I’ve gone back and forth over the years configuring MySQL for optimal performance, and while I know I’m not there, I now have a new baseline to build from. From a post called Standard MYSQL my.cnf configuration, you can see all the base information, but also things like:

key_buffer=256M # 64M for 1GB, 128M for 2GB, 256 for 4GBWhich defines the value (256M) but then spells out ideal base values for you to start with if you have more RAM on your system. This is very helpful, I’m tried to go a step further by combining it with Debian’s default my.cnf that comes on 5.0 (lenny) for MySQL 5. As I’m always open for suggestions for improvements, please comment if you have a different view on these choices, thanks. Here it is:

[client]
socket=/var/run/mysqld/mysqld.sock
port=3306

[mysqld_safe]
socket=/var/run/mysqld/mysqld.sock
nice=0

[mysqld]
user=mysql
bind-address=127.0.0.1
datadir=/var/lib/mysql
pid-file=/var/run/mysqld/mysqld.pid
socket=/var/run/mysql/mysql.sock
port=3306
tmpdir=/tmp
language=/usr/share/mysql/english
skip-external-locking
query_cache_limit=1M
query_cache_size=32M
query_cache_type=1
max_connections=3000
max_user_connections=600
interactive_timeout=100
wait_timeout=100
connect_timeout=10
thread_stack=128K
thread_cache_size=128
myisam-recover=BACKUP
#key_buffer - 64M for 1GB, 128M for 2GB, 256 for 4GB
key_buffer=64M
#join_buffer_size - 1M for 1GB, 2M for 2GB, 4M for 4GB
join_buffer=1M
max_allowed_packet=32M
table_cache=1024
#sort_buffer_size - 1M for 1GB, 2M for 2GB, 4M for 4GB
sort_buffer_size=1M
#read_buffer_size - 1M for 1GB, 2M for 2GB, 4M for 4GB
read_buffer_size=1M
#read_rnd_buffer_size - 768K for 1GB, 1536K for 2GB, 3072K for 4GB
read_rnd_buffer_size=768K
max_connect_errors=10
thread_concurrency=4
#myisam_sort_buffer_size - 32M for 1GB, 64M for 2GB, 128 for 4GB
myisam_sort_buffer_size=32M
skip-locking
skip-bdb
expire_logs_days=10
max_binlog_size=100M
server-id=1

[mysql.server]
user=mysql
basedir=/usr

[safe_mysqld]
bind-address=127.0.0.1
err-log=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
open_files_limit=8192
SAFE_MYSQLD_OPTIONS=”–defaults-file=/etc/my.cnf –log-slow-queries=/var/log/slow-queries.log”

#[mysqldump]
#quick
#quote-names
#max_allowed_packet=16M

[mysql]
#no-auto-rehash # faster start of mysql but no tab completition

[isamchk]
#key_buffer - 64M for 1GB, 128M for 2GB, 256M for 4GB
key_buffer=64M
#sort_buffer - 64M for 1GB, 128M for 2GB, 256M for 4GB
sort_buffer=64M
#read_buffer - 16M for 1GB, 32M for 2GB, 64M for 4GB
read_buffer=16M
#write_buffer - 16M for 1GB, 32M for 2GB, 64M for 4GB
write_buffer=16M

[myisamchk]
#key_buffer - 64M for 1GB, 128M for 2GB, 256M for 4GB
key_buffer=64M
#sort_buffer - 64M for 1GB, 128M for 2GB, 256M for 4GB
sort_buffer=64M
#read_buffer - 16M for 1GB, 32M for 2GB, 64M for 4GB
read_buffer=16M
#write_buffer - 16M for 1GB, 32M for 2GB, 64M for 4GB
write_buffer=16M

[mysqlhotcopy]
interactive-timeout

!includedir /etc/mysql/conf.d/

7/05/2011

HTML5

HTML5

framework
http://www.limejs.com/ : is a HTML5 game framework for building fast, native-experience games for all modern touchscreens and
desktop browsers.