FUNCTIONAL REQUIREMENT
- Web server, Internet access.
- Static Web pages
- Dynamic pages via PHP
- Servlets (Java code on the server)
- Data stored in a database
ROBUSTNESS AND LOADING REQUIREMENT
Requirement for parallel provision of all elements
- To ensure that the system remains operation on any one failure
- To provide extra load handling capability
- To provide a system that can be extended by adding extra parallel units
CHOSEN COMPONENT PARTS
- Apache httpd web server
- PHP
- Tomcat
- JSDK
- MySQL
APPLICATION OVERVIEW
The application has a number of clients who connect in using their browsers, and who log in to the system to go through a series of transactions in a session. In the rare event of a component failing, it is acceptable for their session to be dropped, but they must be able to log back in and continue their work. Around 30% of the SQL requests are Insert / Update / Replaces, but they are very simple enquiries. The remaining 70% or so may be quite complex selects and it's anticipated that the main system load will be in this area and in the PHP and Java that's making those select enquiries.
SCHEME - MANAGEMENT OVERVIEW
All systems to be built the same, with slightly varied configuration files to control their functionality. Three different functional configurations.
a) FRONT END system. Receives all incoming requests (httpd) and passes on the requests to the appropriate MIDDLE TIER system. One front end system running at a time, with fail-over.
b) MIDDLE TIER system. Running httpd (and PHP), Tomcat (and Java) and MySQL as a slave server. Runs requests passed on (through mod_rewrite or mod_proxy) from the front end system. SELECT queries are run on the local slave server on each middle tier system. Queries that change the database are run on the Master database system.
c) MASTER DATABASE SYSTEM. Running the MySQL Master. All inserts and other database changes are made on this one system, and those changes are replicated out to all Slave servers on the middle tier systems. One Master database system running at a time, with failover.
The Front end and Master database system both support all the operations of the middle tier systems, and in a small system (three systems in total) will take an equal proportion of the traffic that's being shared out by httpd on the front end system. As the number of middle tier systems is increased, the middle tier functionality will be handed out with more of a bias until (in a setup with - say - 9 computers) the front end and master database system are providing only that functionality.
Let's number the front end system "1", the middle tier systems "2", "3" and "4", and the master database system "5". Then ....
System 2 will run an extra task that monitors the front end system and if the front end system fails, takes over.
System 4 will run an extra task that monitors the master database system and if that fails, takes over.
Such failovers can be programmed to go "along the line" if necessary. Restoration will be a manual process, but a straightforward one once the reason for the failure has been diagnosed and fixed.
In an extreme situation, it's possible for the whole system's functionality to be being provided by a single machine (extended power failure, running very few computers off a generator perhaps?) and it would be possible to configure a setup with just front end and master database systems. I'm recommending strongly against this for the first configuration tested, since it would not be possible to provide adequate Research and Development testing.
CONSIDERATIONS IN THE DESIGN
How to ensure that a returning session is always passed on to the correct machine.
How to ensure there are not long delays at failover.
Ensuring that data entered on one system is timelessly available on others.
Ensuring data integrity through failures.
Ensuring that the whole system isn't overspec'ed and overcomplex.
Ensuring that the system is easy to operate and maintain.
ELEMENT DETAILS / CONFIGURATION INFORMATION
This would turn into a very long article - subject(s) covered on our courses - further content may be added here in due course
See also
Deploying Apache httpd and Tomcat
Web Application Deployment - Using Tomcat and Apache httpd Together [3018] Tuning Apache httpd and Tomcat to work well together - (2010-10-27)
[2482] Load balancing with sticky sessions (httpd / Tomcat) - (2009-10-29)
[1944] Forwarding session and cookie requests from httpd to Tomcat - (2008-12-14)
[1940] URL rewriting with front and back servers - (2008-12-14)
[1938] Predictive Load Balancing - PHP and / or Java - (2008-12-13)
[1771] More HowTo diagrams - MySQL, Tomcat and Java - (2008-08-24)
[1552] Extra public classes in deploying Apache httpd and Tomcat - (2008-02-24)
[1549] http, https and ajp - comparison and choice - (2008-02-22)
[1383] Monitoring mod_jk and how it is load balancing - (2007-10-07)
[1376] Choosing between mod_proxy and mod_rewrite - (2007-10-02)
[631] Apache httpd to Tomcat - jk v proxy - (2006-03-03)
[576] Why run two different web servers - (2006-01-25)
[436] Linking Apache httpd to Apache Tomcat - (2005-09-05)
Web Application Deployment - More Tomcat Configuration [3018] Tuning Apache httpd and Tomcat to work well together - (2010-10-27)
[2272] Monitoring and loading tools for testing Apache Tomcat - (2009-07-07)
[1899] Virtual Hosting under Tomcat - an example - (2008-11-22)
[1718] Increasing Java Virtual Machine memory for Tomcat - (2008-07-24)
[1370] Apache Tomcat Performance Tuning - (2007-09-29)
[466] Separating 'per instance' data from binaries and web sites - (2005-10-16)
[282] Short weekend - (2005-04-17)
Web Application Deployment - Further httpd Configuration [3449] Apache Internal Dummy Connection - what is it and what should I do with it? - (2011-09-19)
[3133] An image from a website that occasionally comes out as hyroglyphics - (2011-01-14)
[2900] Redirecting a page - silent, temporary or permanent? - (2010-08-03)
[2478] How did I do THAT? - (2009-10-26)
[2272] Monitoring and loading tools for testing Apache Tomcat - (2009-07-07)
[2060] Database connection Pooling, SSL, and command line deployment - httpd and Tomcat - (2009-03-01)
[1974] Moving a directory on your web site - (2009-01-03)
[1955] How to avoid duplicating web page maintainance - (2008-12-20)
[1954] mod_rewrite for newcomers - (2008-12-20)
[1939] mod_proxy_ajp and mod_proxy_balancer examples - (2008-12-13)
[1778] Pointing all the web pages in a directory at a database - (2008-08-30)
[1767] mod_proxy and mod_proxy_ajp - httpd - (2008-08-22)
[1762] WEB-INF (Tomcat) and .htaccess (httpd) - (2008-08-20)
[1707] Configuring Apache httpd - (2008-07-12)
[1636] What to do if the Home Page is missing - (2008-05-08)
[1619] User and Group settings for Apache httpd web server - (2008-04-22)
[1566] Strange behaviour of web directory requests without a trailing slash - (2008-03-06)
[1564] Default file (MiMe types) for Apache httpd and Apache Tomcat - (2008-03-04)
[1554] Online hotel reservations - Melksham, Wiltshire (near Bath) - (2008-02-24)
[1551] Which modules are loaded in my Apache httpd - (2008-02-23)
[1381] Using a MySQL database to control mod_rewrite via PHP - (2007-10-06)
[1377] Load Balancing with Apache mod_jk (httpd/Tomcat) - (2007-10-02)
[1355] .php or .html extension? Morally Static Pages - (2007-09-17)
[1351] Compressing web pages sent out from server. Is it worth it? - (2007-09-14)
[1207] Simple but effective use of mod_rewrite (Apache httpd) - (2007-05-27)
[1121] Sharing the load with Apache httpd and perhaps Tomcat - (2007-03-29)
[1080] httpd.conf or .htaccess? - (2007-02-14)
[1009] Passing GET parameters through Apache mod_rewrite - (2006-12-27)
[934] Clustering, load balancing, mod_rewrite and mod_proxy - (2006-11-21)
[853] To list a directory under httpd on a web server, or not? - (2006-09-02)
[755] Using different URLs to navigate around a single script - (2006-06-11)
[662] An unhelpful error message from Apache httpd - (2006-03-30)
[649] Denial of Service ''attack'' - (2006-03-17)
[631] Apache httpd to Tomcat - jk v proxy - (2006-03-03)
[550] 2006 - Making business a pleasure - (2006-01-01)
[526] Apache httpd - serving web documents from different directories - (2005-12-12)
[466] Separating 'per instance' data from binaries and web sites - (2005-10-16)
[345] Spotting a denial of service attack - (2005-06-12)
Sourcing, Running and Configuring MySQL [2458] Cant connect to local MySQL server through socket /tmp/mysql.sock - (2009-10-17)
[2445] Securing MySQL on a production server - (2009-10-09)
[2444] Potted MySQL installation - (2009-10-09)
[2426] Which version of MySQL am I running? - (2009-09-26)
[2209] Monitoring and Tuning your MySQL installation - (2009-05-31)
[2085] MySQL - licensing issues, even with using the name - (2009-03-16)
[1935] Summary of MySQL installation on a Linux system - (2008-12-11)
[1771] More HowTo diagrams - MySQL, Tomcat and Java - (2008-08-24)
[1731] Apache httpd, MySQL, PHP - installation procedure - (2008-08-01)
[1689] Some sideways thoughts on the news - (2008-06-27)
[1131] MySQL - Password security (authentication protocol) - (2007-04-02)
[1123] mysqldump and mysqlrestore - (2007-03-30)
[1095] Apache httpd , browser, MySQL and MySQL client downloads - (2007-02-28)
[907] Browser -> httpd -> Tomcat -> MySQL. Restarting. - (2006-10-28)
[591] Key facts - SQL and MySQL - (2006-02-04)
[535] MySQL permissions and privileges - (2005-12-20)
[515] MySQL - an FAQ - (2005-12-03)
[489] Which MySQL server am I using? - (2005-11-07)
[334] Symbolic links and hard links - (2005-06-02)
[192] Current MySQL and PHP paths and upgrades - (2005-01-28)
Web Application Deployment - Clustering and load balancing [3339] Simplest ever proxy configuration? - (2011-06-28)
[3293] Distributing the server load - yet ensuring that each user return to the same system (Apache httpd and Tomcat) - (2011-05-18)
[2483] Clustering on Tomcat - (2009-10-30)
[2482] Load balancing with sticky sessions (httpd / Tomcat) - (2009-10-29)
[2059] Sharing the load between servers - httpd and Tomcat - (2009-02-28)
[1995] Automated server heartbeat and health check - (2009-01-16)
[1993] Load Balancing - Hardware or Software? - (2009-01-15)
[1771] More HowTo diagrams - MySQL, Tomcat and Java - (2008-08-24)
[1121] Sharing the load with Apache httpd and perhaps Tomcat - (2007-03-29)
[934] Clustering, load balancing, mod_rewrite and mod_proxy - (2006-11-21)
resource index - Deployment
Solutions centre home page
You'll find shorter technical items at
The Horse's Mouth and
delegate's questions answered at
the
Opentalk forum.
At Well House Consultants, we provide
training courses on
subjects such as Ruby, Lua, Perl, Python, Linux, C, C++,
Tcl/Tk, Tomcat, PHP and MySQL. We're asked (and answer)
many questions, and answers to those which are of general
interest are published in this area of our site.