Wednesday 30 May 2012

Memcached ?????

Distributed object caching system, generic in nature is Memcached. It is free and open source, speeding up dynamic web applications by allevaiating database load. Memcached is an in-memory key-value store for small chunks of arbitrary data from results of database calls, API calls, or page rendering.

e.g.

function getMemCached(memid)
    mem = memcached_get("mem:" . memid
)
    return mem
 if defined 
mem

    mem = fetch_foo_from_database(memid)
    memcached_set("mem:" . memid, mem)
    return mem
end

Disadvantage of index

Remember some disadvantages of index


Each index  occupy some extra space on the disk, which means that as the data increases it need some extra space not to store data but to maintain index data also.

Indexes  Slow down the insertion and updation of the table- because index has to maintain the details about the original data , when data is inserted or updated the index will have to updated as well . In case of multiple indexes ,  these multiple indexes will have to be updated on insert and update operation and hence the operations will become slow.

Set file size limit using .htaccess file

Write below code into your .htaccess file to upload file size limit.

php_value upload_max_filesize 50M
php_value post_max_size 5M
php_value max_execution_time 300
php_value max_input_time 100

Tuesday 29 May 2012

Benefits of Mysql Query Cache

Mysql Query Cache

Query cache stores both the query SELECT text and result fetched by the query which was sent to the client. For second time it check same query if it matches it don't send query to DB engine, shows data from cache.....Its time saving.

Caching in Cakephp

Element Caching in Cakephp

Cakephp view can be cached if set to true (1 day by default but can be set alternate time).

<?php echo $this->element('elementname', array('cache' => true)); ?>

Create Slave User to Mysql

Mysql Slave User


mysql> CREATE USER 'repl'@'%.domainname.com' IDENTIFIED BY 'yourpassword';
mysql> GRANT REPLICATION SLAVE ON *.* TO 'repl'@'%.domainname.com';