Turn on MySQL query cache to speed up query performance?

by Tweak on April 20, 2011
in Mysql

Many times developers looking for ways to speed up query, in mysql we can enable query cache to speed up query performance. Whenever query cache is enable, it will cache the query in memory and boost query performance.

As we know, speed is always the most important element in developing a website especially for those high traffic database driven website. You can try to turn on query cache to speed up query.

To speed up query, enable the MySQL query cache, before that you need to set few variables in mysql configuration file (usually is /etc/my.cnf or my.ini)

- 1st, set query_cache_type to 1. (There are 3 possible settings: 0 (disable / off), 1 (enable / on) and 2 (on demand).

query-cache-type = 1
Read more…

Install mcache (msession) to be used for session caching in PHP

by Tweak on September 30, 2010
in Ajax

Installing mcache, previously known as msession, on CentOS 32 bit system.

MCache can be used completely transparently to a PHP application. By editing PHP’s “php.ini” file to use MCache as its default session handler (see Appendix D), applications will simply use MCache without knowing. This has an advantage in that MCache presents a standard interface for PHP regardless of it storage configuration. It can even hide which storage system or database is used and provides an amount of connection pooling and SQL caching.

If you are on 64 bit system, you will get errors, lots of them. Following instructions work fine with 32 bit systems. For more help look at the MCache Handbook.

Web site: http://www.mohawksoft.org/?q=node/32
PHP reference: http://us2.php.net/manual/en/ref.msession.php
Read more…

Installing Nginx on CentOS 5

by Tweak on September 18, 2010
in Servers

Nginx, pronounced “Engine X”, is a high-performance Web server and reverse proxy. It was created by Igor Sysoev for rambler.ru, Russia’s second-largest Web site. Rambler has used Nginx since summer 2004, and it’s currently serving about 500 million requests per day. Like Apache, Nginx is used by some of the largest Web sites in the US, including WordPress , Hulu and MochiMedia. As of May 2010, Nginx is the third most popular Web server across all domains.
Read more…

How to install memcached

by Tweak on September 17, 2010
in Linux, Servers

Memcached is a very popular open source object caching server. It was developed to speed up livejournal.com by Danga Interactive. We use memcached for a lot of our sites. We use it for different purposes but one main purpose is to cache query results so we don’t have to keep hitting database. As most of the people who work with databases know it is costly to keep hitting database for same information over and over.

When you run the Memcached daemon, it runs and listens on a specific port. One of the things Memcached does lack is security. Memcached will let anybody who can make a connection to its port have full access to all objects. So you would have to run a firewall to block unauthorized access. It is usually wise to do put firewall on it even if you trust everybody on the same network since accidents do happen. That said, let’s get memcached installed!
Read more…

How To Install IonCube Loader

by Tweak on June 14, 2009
in Php

If you need IonCube loader in order to encode scripts. You will need to install IonCube loadar on your box.

  1. Login to your server as root and download the loaderfor your server: http://www.ioncube.com/loader_download.php
  2. Then extract it
    tar -zxvf ioncube_loaders.tar.gz
    cd ioncube
  3. Copy ioncube-install-assistant.php file to a www diretory
    cp ioncube-install-assistant.php /home/username_here/www
  4. Read more…

Displaying PHP APC Cache Information

by Tweak on June 8, 2009
in Php

APC is the Alternative PHP Cache, which is a free, open, and robust framework for caching and optimizing PHP intermediate code. I posted about how to install APC on Linux a couple of days ago, and will now look at the apc.php script which comes with APC and shows information about how much of the cache is being used, what files are being cached, the number of times they’ve been accessed etc.
Read more…

Installing the Alternative PHP Cache (APC)

by Tweak on June 5, 2009
in Php

APC is the Alternative PHP Cache, which is a free, open, and robust framework for caching and optimizing PHP intermediate code. What this means is that APC reads your PHP files, parses them into a more efficient binary format and then caches them in memory so that each request for your PHP files and PHP library files can be fed from the parsed cache. This will generally lead to a speed increase when serving a PHP site, especially one with a lot of library files. This post looks at how to install APC for PHP on Linux. The Linux distribution I used was CentOS 5, but it should be fairly similar for most distros.
Read more…