[Freeswitch-users] High load on database server

EdPimentl edpimentl at gmail.com
Tue Oct 25 22:19:14 MSD 2011

Use Memcache
The recommended approach for using memcached and MySQL is:
Write scale the database by sharding. Partition data across multiple
servers so more data can be written in parallel. This avoids a single
server becoming the bottleneck.
Front MySQL with a memcached farm to scale reads. Applications access
memcached first for data and if the data is not in memcached then the
application tries the database. This removes a great deal of the load
on a database so it can continue to perform it's transactional duties
for writes. In this architecture the database is still the system of
record for the true value of data.
Use MySQL replication for reliability and read query scaling. There's
an effective limit to the number of slaves that can be supported so
just adding slaves won't work as scaling strategy for larger sites.

Using this approach you get scalable reads and writes along with high

Given that MySQL has a cache, why is memcached needed at all?
The MySQL cache is associated with just one instance. This limits the
cache to the maximum address of one server. If your system is larger
than the memory for one server then using the MySQL cache won't work.
And if the same object is read from another instance its not cached.
The query cache invalidates on writes. You build up all that cache and
it goes away when someone writes to it. Your cache may not be much of
a cache at all depending on usage patterns.
The query cache is row based. Memcached can cache any type of data you
want and it isn't limited to caching database rows. Memcached can
cache complex complex objects that are directly usable without a join.

Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users mailing list