Multiple webserver access same file at the same time?

Events happening in the community are now at Drupal community events on www.drupal.org.
jiajun's picture

Hi all,
I am setting up a website with Drupal 7. In plan, I will have Varnish+HAproxy+Drupal7+memcached+mysql+nfs. Here I have a question that if I have 2 webservers running same drupal, what will happen if the 2 webserver write the same file or same database entry? Is there anything I could do to avoid such situation? Or if drupal itself has mechanism to avoid it? Is Mysql Cluster or Glusterfs could help on such situation?

I am not sure if this is the right place for the question. If not, please point me the right place.

Thanks a lot.

Comments

I don't believe HAproxy is

scottatdrake's picture

I don't believe HAproxy is necessary between Varnish and the web servers. As I understand it, Varnish can do the load balancing. See the section in this article about Health Checks and Directors.

Having the web servers "write the same file or same database entry" is not really a concern. With NFS, they are essentially writing to the same file system and table locks should protect the database. We have five web servers on NFS and sharing one database. Never had a problem with it.

If you need multiple databases, you'll want a MySQL Master-Slave setup, not Mysql Cluster. They are different and you don't want the latter.

The article linked above is a great resource.

Thanks for the suggestion,

jiajun's picture

Thanks for the suggestion, Scott. The article is helpful. I will start with varnish and NFS. And yes, I think what I need is MySQL Master-Slave. I will add it after the basic infrastructure is ready.

High performance

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: