Thursday, April 22, 2010

tuning linux OS parameters

cat /proc/sys/fs/file-max
set fs.file-max=102642 into /etc/sysctl.conf

Increase default socket send/receive buffer

sysctl -w net.core.rmem_default=262144
(default socket receive buffer)

sysctl -w net.core.wmem_default=262144
(default socket send buffer)

sysctl -w net.core.rmem_max=262144
(max socket receive buffer)
sysctl -w net.core.wmem_max=262144
(max socket send buffer size)

Optimize MTU. The TCP maximum transfer unit is 1512 on the Internet. If you are sending larger packets it's a good idea to increase MTU size in order to reduce packet fragmentation (especially if you have a slow network)

vi /etc/sysconfig/network-scripts/ifcfg-xxx (eth0 for instance)

– add "MTU=9000" (for gigabit ethernet)
– restart the interface (ifdown eth0;ifup eth0)

Use Big Memory Pages

Default page size is 4KB (usually too small!)
Check page size with:

#cat /proc/meminfo

If you see "HugePage_Total," "HugePages_Free" and "Hugepagesize", you can apply this optimization

example to set 2GB Heap Size

#echo 2147483647 > /proc/sys/kernel/shmmax
#echo 1000 > /proc/sys/vm/nr_hugepages

Blogger Buzz: Blogger integrates with Amazon Associates

Blogger Buzz: Blogger integrates with Amazon Associates

Tuesday, April 20, 2010

increase socket/file open limit in linux

for temporary setting for file max

sysctl -w fs.file-max=100000

for permanent setting

echo "fs.file-max = 10000" >> /etc/sysctl.conf

sysctl -p

for open files

[root@rtapp5in bin]#ulimit -a

[root@rtapp5in bin]# ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 71680
max locked memory (kbytes, -l) 32
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 10240
cpu time (seconds, -t) unlimited
max user processes (-u) 71680
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited

[root@rtapp5in bin]# ulimit -n unlimited
-bash: ulimit: open files: cannot modify limit: Operation not permitted

make changes in /etc/security/limits.conf

add following lines

* soft nofile unlimited
* hard nofile 65535

Monday, April 19, 2010

Enabling the dag wiers repository on centos

Dag Wiers provides an excellent repository for Red Hat flavored Linux systems, its very easy to configure them on centos5

Download and install rpmforge-release

wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.1-1.el5.rf.i386.rpm

rpm -ivh rpmforge-release-0.5.1-1.el5.rf.i386.rpm

Its Done!

Thursday, April 15, 2010

easy way to installl imagic php module

Install modules from PECL(a repository for PHP Extensions, providing a directory of all known extensions and hosting facilities for downloading and development of PHP extensions.)

install pecl first:

wget http://pear.php.net/go-pear
php go-pear
yum install ImageMagick
yum install ImageMagick-devel
pecl install imagick

echo "extension=imagick.so" >> /etc/php.ini

Wednesday, April 14, 2010

easy way to install php gd on linux

[root@dev ~]# yum install php-gd
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* addons: mirror.eshk.hk
* base: mirror.eshk.hk
* extras: mirror.eshk.hk
* rpmforge: fr2.rpmfind.net
* updates: mirror.eshk.hk
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package php-gd.i386 0:5.1.6-24.el5_4.5 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================================
Package Arch Version Repository Size
=============================================================================================================================================================
Installing:
php-gd i386 5.1.6-24.el5_4.5 updates 116 k

Transaction Summary
=============================================================================================================================================================
Install 1 Package(s)
Update 0 Package(s)
Remove 0 Package(s)

Total download size: 116 k
Is this ok [y/N]: y
Downloading Packages:
php-gd-5.1.6-24.el5_4.5.i386.rpm | 116 kB 00:18
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : php-gd 1/1

Installed:
php-gd.i386 0:5.1.6-24.el5_4.5

Complete!


[root@dev ~]# echo "extension=gd.so" >> /etc/php.ini

easy way to install php dom/xmlreader/xxmlwriter/xml module on linux

[root@dev ~]# yum install php-dom
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* addons: mirror.eshk.hk
* base: mirror.eshk.hk
* extras: mirror.eshk.hk
* rpmforge: fr2.rpmfind.net
* updates: mirror.eshk.hk
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package php-xml.i386 0:5.1.6-24.el5_4.5 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================================
Package Arch Version Repository Size
=============================================================================================================================================================
Installing:
php-xml i386 5.1.6-24.el5_4.5 updates 96 k

Transaction Summary
=============================================================================================================================================================
Install 1 Package(s)
Update 0 Package(s)
Remove 0 Package(s)

Total download size: 96 k
Is this ok [y/N]: y
Downloading Packages:
php-xml-5.1.6-24.el5_4.5.i386.rpm | 96 kB 00:18
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : php-xml 1/1

Installed:
php-xml.i386 0:5.1.6-24.el5_4.5

Complete!


Enable mudules (/usr/lib/php/modules/) in php.ini

echo "extension=dom.so" >> /etc/php.ini
echo "extension=xmlreader.so" >> /etc/php.ini
echo "extension=xmlwriter.so" >> /etc/php.ini
echo "extension=xsl.so" >> /etc/php.ini

#Reload apache
[root@dev ~]# /etc/init.d/httpd reload

Followers

About Me

My photo

My Name is Yogesh Malik, I am working in Times Group.