Best practices for deploying Java webapps with minimal downtime?

前端 未结 18 1845
我在风中等你
我在风中等你 2021-01-29 18:28

When deploying a large Java webapp (>100 MB .war) I\'m currently use the following deployment process:

  • The application .war file is expanded locally on the develop
18条回答
  •  离开以前
    2021-01-29 18:39

    Your approach to rsync the extracted war is pretty good, also the restart since I believe that a production server should not have hot-deployment enabled. So, the only downside is the downtime when you need to restart the server, right?

    I assume all state of your application is hold in the database, so you have no problem with some users working on one app server instance while other users are on another app server instance. If so,

    Run two app servers: Start up the second app server (which listens on other TCP ports) and deploy your application there. After deployment, update the Apache httpd's configuration (mod_jk or mod_proxy) to point to the second app server. Gracefully restarting the Apache httpd process. This way you will have no downtime and new users and requests are automatically redirected to the new app server.

    If you can make use of the app server's clustering and session replication support, it will be even smooth for users which are currently logged in, as the second app server will resync as soon as it starts. Then, when there are no accesses to the first server, shut it down.

提交回复
热议问题