The query cache stores the text of a SELECT statement together with the corresponding result that was sent to the client. If an identical statement is received later, the server retrieves the results from the query cache rather than parsing and executing the statement again.
By default query cache size is 0, which is deactivated. To enable it, you can set the query_cache_size to 1000000.
mysql> SET GLOBAL query_cache_size = 1000000;
Query OK, 0 rows affected (0.04 sec)
mysql> SHOW VARIABLES LIKE 'query_cache_size';
+------------------+--------+
|Variable_name | Value |
+------------------+--------+
| query_cache_size | 999424 |
+------------------+--------+
1 row in set (0.00 sec)
A Linux blog by ioMeWeekly, includes tutorials, news, help, programming, tips and how-to guides for opensource applications.
Wednesday 10 April 2013
Create barcodes on CENTOS/FEDORA Linux
To create barcode for Linux, you need to install "barcode" rpm. Suppose you want to create a 13 numbers barcode, and save it to postscript file, and convert the postscript file to pdf, you can do this.
[root@centos6-1 temp]# yum install barcode [root@centos6-1 temp]# barcode -o test.ps -e EAN -b 9557447805435 [root@centos6-1 temp]# ps2pdf test.ps test.pdf
Tuesday 9 April 2013
How to install Perl modules using CPAN
To install additional Perl modules found in CPAN, but not in yum, you can download Perl-CPAN package. Lets say you need a Perl module call "Time::HiRes". You can do this.
[root@localhost ~]# yum install perl-CPAN [root@localhost ~]# cpan Terminal does not support AddHistory. cpan shell -- CPAN exploration and modules installation (v1.9800) Enter 'h' for help. cpan[1]> install Time::HiRes
How to display multiple memcache servers statistics
To display multiple memcache servers statistics, you can run below php script.
<?php $servers = array( array('127.0.0.1', 11211, 33), array('192.168.0.55', 11211, 67) ); $memcache = new Memcache; $memcache->addServer('192.168.0.23',11211); $memcache->addServer('192.168.0.55',11211); $return = $memcache->getExtendedStats(); $unique_key=array(); foreach ($return as $key => $value) { foreach ($value as $key2 => $value2) { array_push($unique_key,$key2); } } $unique_key=array_unique($unique_key); echo "<table border='2' align=\"center\" width=\"100%\" >"; echo "<tr><th/>"; foreach ($return as $key => $value) { echo "<th>$key</th>"; } echo "</tr>"; foreach ($unique_key as $key0) { echo "<tr align=\"center\"><td>$key0</td>"; foreach ($return as $key => $value) { echo "<td>".$return[$key][$key0]."</td>"; } echo "</tr>"; } echo "</table>"; ?>
Labels:
memcache
,
multiple
,
servers
,
statistics
Monday 8 April 2013
Upgrade PECL Memcache extension
The following instructions will download latest PECL Memcache extension. Goto PECL Memcache website. Download the tgz file using wget, and install as follows.
$ mkdir /tmp/temp $ cd /tmp/temp $ wget http://pecl.php.net/get/memcache-3.0.8.tgz $ tar -xzvf memcache-3.0.8.tgz $ cd memcache-3.0.8/ $ phpize $ ./configure $ make $ make test $ make install $ service httpd restart
How to display memcache statistics at bash shell
To display memcache statistics at command prompt, you can enter below command. This command will display memcache statistics like "top", updating the statistic every 2s.
watch "echo stats|nc 127.0.0.1 11211"
Labels:
bash
,
commandline
,
memcache
,
statistics
How to display memcache statistics with php
To display memcache statistics, you can create a php script as shown below. This scripts uses "getStats" command to display the statistics. You can also format it into a html table.
<?php $memcache_host="127.0.0.1"; $memcache_port="11211"; $memcache = new Memcache; $memcache->connect($memcache_host,$memcache_port) or die ("Cannot connect"); $return=($memcache->getStats()); foreach ($return as $key => $value) { echo $key." : ".$value."<br>"; } ?>
Labels:
memcache
,
php
,
statistics
,
status
Subscribe to:
Posts
(
Atom
)