douna3367 2017-01-18 04:14
浏览 24

具有粘滞会话的PHP应用程序的CodeDeploy

I have a PHP application running on an AWS auto-scale group that uses sticky sessions behind an AWS ELB.

When running CodeDeploy against these machines to release, CodeDeploy will initially delete the files before replacing them with the new ones. However, during that short period of time, all web requests hitting the servers will receive 404s or 500 server errors due to the files not all being there.

Connection draining and pulling the servers out of the pool won't work due to sticky sessioning as we'd be logging the users out of the system when we pulled a server out of the pool.

I've considered code deploying to a new directory in the file system and rsyncing over, but I think that would only partially solve the problem since rsync isn't instantaneous either.

Is there an option for sticky sessioned servers like this to see a seamless deploy?

  • 写回答

1条回答 默认 最新

  • doubi7496 2017-07-10 18:47
    关注

    One option that might help is to rely on File Exists Behavior and set to the RETAIN option. The flag in the aws deploy create-deployment command is --file-exists-behavior: https://docs.aws.amazon.com/cli/latest/reference/deploy/create-deployment.html

    If you create the deployment through the console there's a way to select the "Content options" which allows you to specify whether the deployment should fail, overwrite, or retain the file.

    But I'm not 100% sure if that solves the problem since then you don't update the files during deployment. I quickly read up on sticky sessions... but can your client software simply retry if it loses a sticky session? I can't think of a way around it.

    Like, your host could disappear at any time. During deployment you might be (no idea if you are) removing the host from the load balancer. Your application stop scripts could be shutting down your host's service. I bet that sticky sessions should have a solution where you can drain previous sessions from a host and stop new clients from reaching that host. But I don't know enough about what you're doing here.

    I hope this info helps you. -Asaf

    评论

报告相同问题?

悬赏问题

  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 关于大棚监测的pcb板设计
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器