RockThePost.com is a LAMP stack hosted on Ec2. We're preparing to be featured in an email which will be sent to ~1M investors... all at the same time. For our 2 person engineering department, that meant we had to do a quick sanity check to see just how many people we can support concurrently.
Our app uses PHP's Zend Framework 2. Our web servers are two m1.medium Ec2 machines with an ELB in front of them setup to split the load. On the backend, we're running a master/slave MySQL database configuration. Very typical for most of the small data shops I've worked at.
Here are my opinions and thoughts in random order.
-
Use PHP's APC feature. I don't understand why this isn't on by default but having APC enabled is really a requirement in order for a website to have a chance at performing well.
-
Put everything that's not a .php request on a CDN. No need to bog down your origin server with static file requests. Our deployer puts everything on S3 and we abs path everything to CloudFront. Disclaimer: CloudFront has had some issues lately and we've recently set the site to instead serve all static materials directly from S3 until the CloudFront issues are resolved.
-
Don't make connections to other servers in your PHP code, such as the database and memcache servers, unless it's mandatory and there's really NO other way to do what you're trying to do. I'd guess that the majority of PHP web apps out there use a MySQL database for the backend session management and a memcache pool for caching. Making connections to other servers during your execution flow is not efficient. It blocks, runs up the CPU, and tends to hold up the line, as it were. Instead, use the APC key/value store for storing data in PHP and Varnish for full page caching.
-
I repeat... Use Varnish. In all likelihood, most of the pages on your site do not change, or hardly ever change. Varnish is the Memcache/ModRewrite of web server caching. Putting Varnish on my web server made the single biggest difference to my web app when I was load testing it.
-
Use a c1.xlarge. The m1.medium has only 1 CPU to handle all of the requests. I found that upgrading to a c1.xlarge, which has 8 CPU's, really paid off. During my load test, I did an apt-get install nmon and then ran nmon and monitored the CPU. You can literally watch the server use all 8 of its cores to churn out pages.
Google Analytics shows us how many seconds an average user spends on an average page. Using this information, we ran some load tests with Siege and were able to extrapolate that with the above recommendations, we should be able to handle 30,000 users concurrently per web server on the "exterior" of the site. For "interior" pages which are PHP powered, we're expecting to see something more along the lines of 1,000 concurrent sessions per server. In advance of the email blast, we'll launch a bunch of c1.xlarges and then kill them off slowly as we get more comfortable with the actual load we're seeing on blast day.
Finally, we will do more work to make our code itself more scaleable... however, the code is only about 4 months old and this is the first time we've ever been challenged to actually make it scale.
About RockThePost.com
We help entrepreneurs raise money for a new venture. If you're thinking about crowdfunding your next venture, use coupon code "HACKERNEWS" for a 50% discount on any of our plans.
相关推荐
### Web-Scale PHP数据库连接管理 #### 概述 本文档主要介绍了如何在PHP中高效地管理和使用Oracle数据库,特别是通过OCI8扩展实现这一目标。文档由Oracle公司的产品开发人员Christopher Jones于2008年5月在PHP|Tek...
THR3108 - Extreme scale PHP and Azure.pptx
可扩展的 PHP 基础架构 基于码头工人 里面是什么? 用于处理 PHP 的 作为首选的网络服务器 ...用于应用程序缓存todo clusterize ... $ fig scale php=5 #5 php nodes $ fig scale web=2 #2 nginx nodes
【标题】"基于PHP的田字格笔顺字帖在线生成器php源码.zip" 描述了一款使用PHP编程语言开发的在线工具,该工具能够自动生成田字格笔顺字帖。田字格是一种传统的汉字练习模板,帮助学习者准确掌握汉字的笔画顺序和位置...
`pthreadGC2.dll`是线程库,`php_memcache_vc6.dll`可能是PHP的Memcached扩展,而`phpStudy_2014_setup.1413444920.exe`是PHPStudy的安装程序,一个流行的PHP开发环境。`ffmpeg.exe`是`ffmpeg`的可执行文件,`说明....
田字格笔顺字帖在线生成器是一款基于PHP开发的软件工具,主要用于帮助用户便捷地创建含有正确笔顺的田字格字帖。这款源码包含9574个常用汉字,覆盖了日常生活中最频繁使用的汉字,对于学习汉字书写、教授汉字笔顺...
docker-nginx-php-fpm Docker +(Traefik +)Nginx + PHP-FPM =正确的方法 跑步 docker-compose up --detach docker-compose exec ... --scale php-fpm=3 生产 docker build . --tag wandersonwhcr/hello
'scale' => 4, // 图像大小 'margin' => 4, // 边距 'colorDark' => '#000000', // 二维码颜色 'colorLight' => '#ffffff' // 背景颜色 ); QRcode::png($data, 'path/to/output.png', 'L', $options); ``` *...
, initial-scale=1"> ``` 其次,CSS3引入了媒体查询(Media Queries),这是一种基于设备特性(如宽度、高度、方向等)来应用不同样式的技术。在PHP中,可以创建一个函数来根据设备类型或屏幕尺寸插入不同的CSS链接...
12. 响应式设计:`,minimum-scale=1.0,maximum-scale=1.0">`确保页面在不同设备上适配。 这个PHP源码提供了一个基础的成绩查询框架,用户输入姓名(可能还有验证码)进行查询,服务器端处理请求并与数据库交互以...
完成"scale3c-task"不仅需要熟练的PHP编程技能,还需要对WordPress架构、模板系统和前端开发有深入理解。在实际操作中,开发者可能需要不断调试和调整,以确保HTML5模板在WordPress中的完美呈现。
在PHP中,生成自定义宽高缩略图片是一项常见的任务,尤其在网站开发中,用于显示用户上传的图片或者优化页面加载速度。本教程将详细解释如何使用PHP实现这一功能,以及批量处理大量图片的方法。 首先,我们需要了解...
The rapid maturation of PHP has created a skeptical population of users from more traditional “enterprise” languages who question the readiness and ability of PHP to scale, as well as a large ...
var scale = Math.min(maxWidth / img.width, maxHeight / img.height); // 设置canvas尺寸 canvas.width = img.width * scale; canvas.height = img.height * scale; // 绘制图片 ctx.drawImage(img, 0, 0,...
imagecopyresampled($qrCodeImage, $logoImage, $logoX, $logoY, 0, 0, $logoWidth * $scale, $logoHeight * $scale, $logoWidth, $logoHeight); // 输出或保存 imagepng($qrCodeImage, 'output_with_logo.png');...
ini_set('bcmath.scale', 0); } /** * @covers Moontoast\Math\BigNumber::__construct * @covers Moontoast\Math\BigNumber::getValue * @covers Moontoast\Math\BigNumber::getScale *...
高档 为图像提供最小高度和宽度,并放大太小的上传... 默认情况下,这将是 500x500 像素,但可以使用过滤器cftp_upscale_minimum_width和cftp_upscale_minimum_height进行更改。 这个插件需要 Image Magick PHP 扩展
该库允许您使用纯 PHP 从标准 USB 秤读取重量。 可以轻松移植到其他语言,如果他们有unpack() 测试: Stamps.com 不锈钢 5 磅数字秤 DYMO M25 25 磅数字邮政秤 如果您想一目了然地了解它的工作原理,请参阅或 。...
$movieConverter->setOptions(['-vf', 'scale=w=640:h=360']); // 添加自定义转换选项 $success = $movieConverter->convert(); if ($success) { echo '转换成功!'; } else { echo '转换失败: ' . $...
Yii -- a high-performance component-based PHP framework best for developing large-scale Web applications. Yii comes with a full stack of features, including MVC, DAO/ActiveRecord, I18N/L10N, caching, ...