Solving performance issue DrupalDatabaseCache::clear I am facing a performance issue when I open some of the pages.  It is taking too long time. After checking the queries and the time for each query I found that these two functions are taking a long time:

DrupalDatabaseCache::clear
DrupalDatabaseCache::set


What to do?
If you are facing performance problems using database as cache backend you should consider moving the caches to a better performing cache backend. Suitable backends for general caching are for example Memcached and Redis. For both of these you can find proper contrib modules (Redis &amp; Memcache) and a lot of help in using them. If you want to have high performance page cache you could use Varnish for that. Also setting up APC to improve general PHP performance is a wise thing to do. Some basic information on using APC can be found from here.

Whatever caching methods you choose to use you should remember that form-cache must use non-volatile storage. This means that you should simply remember to keep form-cache in database. This can be achieved by inserting the following to your sites settings.php file.

$conf['cache_class_cache_form'] = 'DrupalDatabaseCache';