GlusterFS issues for Web Serving

glusterfs

I've just tried doing a replicated Gluster setup between 2 web servers.
The performance was very poor with simple PHP file operations like file_exists and is_readable taking 15 – 30ms each. A require_once took 1.1 seconds.

Like most web setups, writes are very infrequent and reads are extremely common.
The servers are 2xquad core Xeons, 8 gig ram and RAID 1 disks. There is a dedicated gigabit network between them.
Its not the fastest way to set up GlusterFS but it shouldn't be this slow.

What is the best way to improve the situation? The documentation on GlusterFS tuning is lacking, and identifying Can where the bottlenecks are is very difficult.

I've seen some mentions that setting the files up distrubted not replicated can improve speed but that halves reliability and I'm looking to improve reliability (two webservers vs one) not decrease it. Is there a specific configuration involving caching and so on for this kind of work load? Can there be a cache for checking for a new copy of a file on the other server so as often as possible files are served instantly from the local hard disk?

Best Answer

You can try mounting gluster via NFS and the performance will be much better because of the caching done by the NFS client.

Alternatively you can also enable prefetch for small files and increase the cache by using gluster set volume option (use gluster help to view all the options).

If you don't have a lot of writing going on maybe rsyncing the directories would be a better option for your scenario.