Performance Deployment Questions

Hi,

I already look after a Drupal site running on Amazon EC2 and I’m interesting in running a yii site in a similar way. Based on my experience with Drupal I’m interested if yii tackles any of the scalability challenges present in Drupal. My questions are:

  • Does the assets folder have to be shared between servers or can each server have its own copy?

  • Is there an easy way in yii to change the file store mechanism to let me push assets and images uploaded by users to Amazon S3? I’m not too bothered about getting assets onto S3 but getting user profile images onto S3 is essential. I want to upload to S3 within the workflow of an image being uploaded and avoid having a CRON job to sync files.

  • Is there anything in yii that requires sticky sessions? Assuming I’m storing sessions in the DB or memcache is there any other reason I’d still require sticky sessions?

  • The documentation talks about “minifying” js using the mapping functionality. This isn’t really minfifying in what I understand to be the true sense of the word i.e. stripping unnecessary white space etc but actually file aggregation which reduces HTTP requests by aggregating files into a single downloadable asset. The documentation does allude to physically minifying js files but doesn’t go into any detail - does anyone have a strategy with yii for minifying JS (and CSS for that matter)?

Thanks,

Paul

  1. Yes, each server can have its own assets directory. You may also configure the application to share the same assets directory.

  2. assets are usually generated by widgets. Yii doesn’t specify where to store user uploaded files. So it doesn’t limit you in this aspect.

  3. What is "sticky session"?

  4. Yes, minifying js/css is as you described. What being said in the guide is to combine multiple js/css files, and use some 3rd party minifying tools to further reduce the total size.

Hi,

Sticky session - for load balancing between servers. A “sticky session” means that the load balancer will always send the user back to the server that processed their original request (instead of using round robin for example). For http traffic sticky sessions frequently aren’t required but I’ve had problems with Drupal in the past when I tried to use “proper” load balancing - hence the question if yii had any similar quirks.

Possibly I’m being pedantic but I wonder if the existing minify functions would be more correctly named if they were related to aggregation? I’m fairly sure both Google and Yahoo make the distinction between file aggregation and minification in their performance tips. Only a thought though - it all works very well regardless!

Thanks for your help,

Paul

Thanks for the explanation.

There is only one thing you need to be careful, that is the validationKey of CSecurityManager. By default, this key is automatically/randomly generated the first time and is stored under runtime directory. In multiple server environment, you should explicitly configure this property so that all servers share the same key. This key is used widely to generate hash keys for various security-related measures.

Other than this, I don’t think Yii should limit you in any other aspects when being used with multiple servers. Yii is a generic framework, while Drupal is a CMS in the first place. So Drupal may have more limitations (which is very reasonable).

Yeah, regarding minifying, we will consider your suggestion. We may add some enhancements in the near future too.

If you’re taking feature requests for enhancements then a nice way of parallelizing resource downloads within css files and the page in general would be fantastic! I found that introducing parallelization into my css files had by the far the biggest performance increase on my site.

That’s if you’re taking requests of course ;)

Hi,

Sorry about re-opening this thread but it seemed the logical place…

Just to clarify on my question about needing sticky sessions (i.e. a load balancer always directing a user back to the same server); If we have two servers each with their own asset directory and we enable page caching is the path to the asset directory also part of the page cache? If so this would presumably mean that we’d need sticky sessions and server specific caching since the asset directory cached in the page would be server specific.

I hope that makes sense! Would be great if someone could confirm my assumption one way or another

Thanks,

Paul.

Hi, I am thinking on deploying a web site into Amazon S3, and thinking of parallel servers for load balancing. I really need information on this, Paulie, did you advance in this direction?

Thank you!

qiang ,

can you please explain how to set the same key to all instances ?

should i extend CSecurityManager and implement generateRandomKey myself with a configuration key ?

or is this something i dont have to do , and there is a better way ?

Hi qiang,

As you said , we just need to set a static key in SecurityManager component right ?

is there any other problem with sessions when we use multiple servers?