Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In a web farm environment, should we base the system date/time to the web servers or the database server?

Tags:

.net

web-farm

Assuming there are a number of load-balanced web servers in a web farm, is it safe to use the app/web server time in the application code for getting the system date/time or should we leave this responsibility to the database server?

Would there be a chance that machine date/time settings on all servers in the webfarm are out of sync?

If date/time will be the responsible of the DBMS, how will this strategy work if we have load-balanced clustered DBs?

like image 413
leypascua Avatar asked May 14 '10 08:05

leypascua


People also ask

How does a web farm work?

A web farm is a group of two or more web servers (or nodes) that host multiple instances of an app. When requests from users arrive to a web farm, a load balancer distributes the requests to the web farm's nodes.

What is a web farm or server farm?

On the Internet, a Web server farm, or simply Web farm, may refer to a Web site that uses two or more servers to handle user requests. Typically, serving user requests for the files (pages) of a Web site can be handled by a single server. However, larger Web sites may require multiple servers.

What is a web farm name three advantages of a web farm?

USE: The Web farms are used in enterprise environments for highly-used web applications to provide fail-safe and reliable services. Web farms offload incoming traffic by alternating between servers and by evenly distributing web application load. This increases response time, performance, and reliability.


2 Answers

You should have a Time Server (-:)

Seriously, the first approach is to make sure all servers use a protocol to sync their clocks. That will leave you with a known worst case deviation. Only if that deviation is larger than you can tolerate (unlikely in a Web App) you will need to engineer something special. Usually the database will be OK, but if that is clustered then you may need to appoint a dedicated server as the keeper of time.

But note that your accuracy will always be bound by the maximum lag of the network.

like image 143
Henk Holterman Avatar answered Sep 19 '22 15:09

Henk Holterman


Best just to have the same time set on all the servers so you don't have to worry about it, otherwise there is always confusion about whether the time comes from.

If the clocks on the servers are set from a time server regularly, they should be accurate to within 100ms of each other at least, which is probably good enough, though obviously it depends on what exactly you are trying to do.

like image 31
Nathan Avatar answered Sep 19 '22 15:09

Nathan