Yii 2.x and high traffic

Recently, I was trying to find out more about PHP frameworks’ performance. It seems like Phalcon has the best metrics so far. It’s not surprising given the fact that they use different architecture (i.e. compiled php extensions). But I really like Yii. :)

I realize that this is a never-ending discussion what is better for high traffic: custom-made framework or a commonly known one. However, I am still curios to hear the feedback from those who use Yii for high traffic (> 100,000K unique visitors per day). What are the performance stats, known issues, etc.?

Hmmm… Well since you did not give too many details, including what you are going to do with those visitor or including a real clear indication of how many… I get to make up my own ;D ;D ;D

100,000K visitors = 100,000,000 visitors a day

== 86,400 seconds in a day…

1,157 hits per second.

I can get about 130 hits per second on a AWS EC2 t2.micro instance with one CPU…

I test this with a page that does a couple of db hits and a little data munging… You mileage WILL vary!!!

I use Nginx and a lot of caching. Nginx performance degrades very smoothly unlike Apache. PHP also uses a LOT LESS memory. Apache is also prone to dropping connections when things get busy.

I don’t get this kind of load on any of my apps, so you have been warned…

So you might need about a 8 core machine… comes out to about $0.41 per hour or about $300 per month.

Of course this assumes that you really did mean 100 MILLION hits a day and that they are spread evenly over the day and you are trying to do this one ONE MACHINE.

If you want to give more information on what you mean, I might update my analysis.

-John Scott

It depends very much on the application and infrastructure. Yii itself isn’t a significant bottleneck and scales well. You can get lots of not so powerful servers behind load balancer and the setup would be able to handle a lot.