Critical Applications

Hi!

I have to develop a webapp to support nearly 1000 concurrent connections.

I want to know your opinion: Should I develop my app with Yii under these conditions?

If so, what kind of configurations should I do to tune Yii, PHP, Apache and whatever?

Thanks for your attention!

Yii is fundamentally developed with high-traffic large-scale webapps in mind. I’m quite sure, if you get it right, Yii will do the rest to support that much simultaneous users.

In this case, you definitely want to keep your database structure neat, your queries fast, APC/memcache/etc. turned on. I also suggest aggressive caching where it is appropriate.

Please note that createUrl() can also be a bottleneck in your application if you have many url rules.

Thanks, Pestaa!

How do you set your application to use CApcCache?

I have used ab -n 1000 -c 10 with a list page from my application. The result was nearly about only 6 rps (without caching). I am a bit worried about this.

Generally using APC is not the same as CApcCache. You can enable and configure APC in your php.ini.

If you want to use APC as a caching facility, set an application component (the default ‘cache’ for example) in your main.php configuration file. Add ‘class’=>‘CApcCache’.

Thanks Pestaa. I know I have to setup APC in my PHP. What I want to know is if there is some specific configurations you use to do in your APC.

Framework alone doesn’t ensure you to have a high-traffic and high-concurrency site. It is more of a system project which involves many aspects.

You need to design your database carefully (e.g. extremely high-traffic site should avoid FK constraints).

You need to write your code carefully (e.g. avoid SQL joins if necessary).

You need to use caching techniques extensively.

You may need multiple web servers and/or DB servers.

With Yii, what you can be sure of is that the framework won’t be the bottleneck. And Yii provides you powerful caching support that you can hardly find in other frameworks.

For your test, as pestaa suggested, enable APC extension and see how much the RPS improves. Note that the "hello world" benchmark already shows you the upper limit.

I see. Personally I don’t use APC yet, as I don’t have even medium-sized webapps. :)

Yii has little overhead (compared to other PHP frameworks). However, as said in previous posts, there could be some other bottlenecks: CPU power, available memory, network bandwidth… even disk speeds.

In my opinion, you should:

  • Use several processing backends and one frontend. There are some ways to use Apache in this setup, but I found lighttpd easier to use (but a bit tricky to configure properlly). You setup one lighttpd frontend and several php-cgi backends, common data and sessions in NFS (or sessions in memcached/memcachedb/database). I would recommend you to do this from the start, so you will avoid a pain in the … when you’re in production :wink:

  • Design you DB and queries (if manually written) carefully (if you use MySQL, it’s a bit tricky regarding indexes).

  • Cache your query results in a smart way (memcached is a good choice)

  • Use some code cache such as APC.

Salut!

This is my situation: My workplace has acquired a third-app developed in Ruby. Our server is receiveng about 100 rps and is hanging down.

So, as the ninja developer of my job ( :lol: ), I was requested to develop a new version of the program (in one day! >:( ). I haven’t perfomed huge performance tests with Yii, so I am a bit worried about it.

However, Qiang is absolutely right. Performance depends on many other variables. But, I was wanting to hear your opinions, anyway.

I’m interesting in this topic… could somebody tell us what are the “general rules to develop a high traffic application”?

e.g.: as Qiang says:

and MetaYii:

Or point us to some read in the www.

Thanks,

PoL

http://www.stevesouders.com/blog

http://provenscaling.com/blog/

Coding Horror

What is the server configuration?

I’m just thinking that I get great scalability out of Apache with a mongrel cluster, and it’s easy to set-up.

Also, since you are using Ruby. Another approach that I’ve used is to use JRuby and deploy via the Glassfish gem – if you can justify running a Glassfish server, which at 100 rps, I suspect you can – then try that. It’s not at all hard to set up.

I don’t know too much about the server, but the Ruby was using mongrel (it seems to be our vilain :P )

Well, my app is at production!! Tomorrow I will post here the results of my little adventure.

Yes, dear pals, it is working like a charm!!!!

You can acess my app at

Bolsa Universidade

We are receiving about 25-30 submissions per minute.

It was like Qiang said. It isn’t enough to tune your Yii application. You have to tune either your Apache and MySQL. In Apache, you have to have memory and connections enough, tune wait_timeout and max_connections in MySQl, etc. And, I didn’t even needed APC.

I luv this framework ;D

Boas.

Check this out, i think you can get some ideas out of it… even tho if its made for ruby on rails, i am sure it will help you out in wateva the language/framework

link : http://railslab.newrelic.com/scaling-rails

Useful link. Thanks.