Thursday, May 13, 2010

installation for Database connection pooling with LAMP

Easy step to install modules/packages for database pooling on Apache/PHP/Linux with real times errors and troubleshooting:

Requirements:

mod_dbi_pool
libdbi
libdbi-drivers

Installation Steps:

Download packages from http://libdbi.sourceforge.net/download.html
Download mod_dbi_pool from http://sisyphus.ru/en/srpm/Sisyphus/apache2-mod_dbi_pool/get

Install and configure libdbi
Install and configure libdbi-drivers
Install and configure mod_dbi_pool with apache


error

Version 1.1, March 2000

Copyright (C) 2000 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.


0. PREAMBLE

make[3]: *** [dbd_mysql/c168.html] Error 1
make[3]: Leaving directory `/opt/libdbi-drivers-0.8.3-1/drivers/mysql'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/opt/libdbi-drivers-0.8.3-1/drivers'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/opt/libdbi-drivers-0.8.3-1'
make: *** [all] Error 2


error2:

[emerg] [mod_dbi_pool.c] - Initlialization of libdbi with default driver directory failed Configuration Failed

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

Followers