often, when someone asks how we are going to scale the web application were about to develop, we look at them, smile, and say, "not a problem - well just cluster the application servers." clustering our application across multiple servers provides us with the ability to handle large volumes of traffic and to scale systems by adding additional servers to the cluster.
in addition to providing scalability, application clusters make the system more robust by allowing for automatic system failover when a server fails. this way when one server goes down the application continues to run, albeit with slightly decreased performance. while it is true that the current generation of application servers makes it relatively pain-free to create a cluster, there are still several significant, if often overlooked, design issues that must be taken into account now that the system is clustered.
when we run our web application in a cluster, we have the exact same software running on each machine in the cluster. while this eliminates a host of configuration management difficulties, it does create other problems. while we dont have to write different code for every possible machine in the cluster, there are times when this simplicity actually makes things more complex; the running of scheduled tasks is typically one of these areas. scheduled tasks are used to execute procedures that need to run at certain fixed times or at fixed intervals. typical examples of scheduled tasks within a web application are report-generation tasks and tasks that send data to external systems that are only available within a certain time frame.
to understand why clustering affects how we design our application to handle scheduled tasks, lets consider a generic e-commerce web application. to allow management to analyze sale... 下一页