Best way to load php classes in EC2 - InstanceStore, EBS or S3?

ⅰ亾dé卋堺 提交于 2019-12-03 03:59:54
Eric J.

Always use an EBS backed instance. Repeat: Always use an EBS backed instance.

When code changes need to be applied, spin up a new EBS backed instance from a snapshot of the current one. Do not add it to your load balancer yet.

Apply code changes.

Create a new EBS snapshot. This is your gold standard snapshot for the current round of code changes.

Launch new EBS-backed instances as needed from the new gold standard snapshot.

Run a script that hits your website on the new instance(s), which are not yet taking real traffic, to warm them up (get the PHP classes loaded into APC).

Switch your load balancer so that the new instances are taking all live traffic.

Terminate the old instances.

All of this can and should be automated with an update script. Be sure and include error checking in your script along the way (for example, I have occasionally been unable to fire up a new instance due to resource constraints in the availability zone).

The ability to create and destroy new instances as needed is one of the wonderful things about the cloud.

have you thought about serializing the object and putting the entire object into the apc cache OR putting it into something like memcached?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!