dongpang1898 2009-08-13 15:24
浏览 37
已采纳

Web应用程序部署到有限的用户群

I'm trying to determine the best way of deploying new versions of an established web application. In the past, I've done it a couple different ways but this time we're looking to do something a little different/better.

We're using development/staging/production servers. After the development is done and the basic functionality is tested, we run the development code with an upgraded production database on the staging server. If our internal QA doesn't find problems in the staging environment, we make those changes live.

That last step has been done in the following two ways:

  1. Upgrade the code and the database schema at a time of low usage, do a bit of testing to make sure the upgrades went OK, then cross fingers and hope the users don't find some bug that QA missed, always ready to put out fires or revert to the previous version in case of major failure.

  2. Create the new version of the application at a different URL. Copy the production database to a new version, empty it, then copy over data for selected users and have them use the new URL. I.e., they would access the application from www2.example.com instead of www.example.com. Slowly move every user to the new version then switch the urls back.

This time I'm looking at doing something like a combination of the two methods. Basically, I'm thinking of moving a small number of users to the new service while keeping the same url.

Here's what I'm considering doing in the virtual host. Map.txt would be generated/updated when the new users are moved over. (I looked at using the prg rewrite map but am afraid of apache hanging waiting for the script.)

<VirtualHost *:80>
ServerAdmin webmaster@lotsa.net
DocumentRoot /web/www.example.com
ServerName www.example.com

RewriteEngine  on

RewriteMap deploymentmap txt:/web/map.txt

RewriteRule ^/id/([0-9]+)/(.*)$ ${deploymentmap:$1}/id/$1/$2

</VirtualHost>

map.txt:

10001 /web/www2.example.com/
10002 /web/www2.example.com/
10003 /web/www2.example.com/
10004 /web/www2.example.com/
10005 /web/www2.example.com/

Are there any obvious flaws in this deployment strategy? Am I missing some simple and effective, less painful, upgrade method?

Thanks in advance for any assistance.

-Paul

  • 写回答

1条回答 默认 最新

  • dragon7088 2009-11-04 13:35
    关注

    Nobody ever answered, so I'll answer myself for posterity. :-)

    This method works very well for a staged deployment of a new codebase over an old codebase. In our particular situation, we did the rollout using a method similar to the above. Initially, all users started with the old system and the rewrite map file was about 800K in size. The server served more than 100K pages with no noticeable difference in speed due to the new rewrite directives.

    I was surprised that Apache didn't have to be restarted after making changes to remove entries from the file (the documentation implies this file is read only at startup). Apache picked up changes to the map right away so it must look at it on every request, or more likely check timestamps/checksums to see if it's different.

    A similar technique could be used not only for deployment but for A/B testing especially in situations where the data structure isn't changing.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效