Best practices for configuring Apache / Tomcat

后端 未结 3 670
孤街浪徒
孤街浪徒 2021-01-31 10:48

We are currently using Apache 2.2.3 and Tomcat 5 (Embedded in JBoss 4.2.2) using mod_proxy_jk as the connector.

Can someone shed some light on the the corre

3条回答
  •  旧时难觅i
    2021-01-31 11:30

    You should consider the workload the servers might get.

    The most important factor might be the number of simultaneously connected clients at peak times. Try to determine it and tune your settings in a way where:

    • there are enough processing threads in both Apache and Tomcat that they don't need to spawn new threads when the server is heavily loaded
    • there are not way more processing threads in the servers than needed as they would waste resources.

    With this kind of setup you can minimize the internal maintenance overhead of the servers, that could help a lot, especially when your load is sporadic.

    For example consider an application where you have ~300 new requests/second. Each request requires on average 2.5 seconds to serve. It means that at any given time you have ~750 requests that need to be handled simultaneously. In this situation you probably want to tune your servers so that they have ~750 processing threads at startup and you might want to add something like ~1000 processing threads at maximum to handle extremely high loads.

    Also consider for exactly what do you require a thread for. In the previous example each request was independent from the others, there was no session tracking used. In a more "web-ish" scenario you might have users logged in to your website, and depending on your software used, Apache and/or Tomcat might need to use the same thread to serve the requests that come in one session. In this case, you might need more threads. However as I know Tomcat at least, you won't really need to consider this as it works with thread pools internally anyways.

提交回复
热议问题