First of all I am happy to see that Yii2 is at beta release which i have been waiting for a long time for this and thanks
I am looking at the basic and advanced template and want to dig deeper with the advanced template. I do a stopwatch on each click to compare how Yii perform when it run entirely on a network share to Yii load the vendor from a local hard drive to see the different on performance.
Entire Yii on network share:
login: 12:10’
contact: 6.95’
about: 6.05’
Yii on network with vendor on local hard drive:
login: 7.58’
contact: 4.13’
about: 4.31’
As you can see there is some performance gain when point the “vendor” folder to a local hard drive but I want it to be a little faster so I start looking around and see some potential such as “assets” and “runtime” folder which is being use for “caching”, “debug” and “logs” but I don’t see any easy way to point these folders to a local hard drive away from where Yii is running from.
I have a need to run Yii from a network share for many reasons.
Is it possible to do that with these folder?
PS: My goal is to have the time on each click down to less then 4’
You can configure runtimePath from main level of application config. Assets is configured as ‘components’ => [‘assetManager’ => [‘basePath’ => ‘xxx’]].
By point “assests” folder to a local hard drive, that cut down the time to less than 3’ but it turns out not a desirable change because it mess up the css path and cause it not to show the layout correctly.
How about the "runtime" folder under frontend and backend?
Can that being point to some where else?
Will that help to speed up thing?
Are there any place else that can be move to tune thing up a little more?
That depends very much on your environment and code so can’t say anything. Profile it, find bottlenecks, fix it. If it’s anything about the framework itself, tell us and we’ll work on it.
It is a stock install of Yii with the advanced template.
The only thing I changes are just point the vendor and runtime folder to a local hard drive and test the timing of frontend and backend by clicking on the each link and the login
For the sake of a baseline comparison, I run Yii from a local hard drive and test the timing of login and it took 6.1’ just to login and compare to running from the network which is 7.5’ so it is something about Yii2 that taking sometime to do database operation.
For me it takes about 765ms to login using database. Most of the time it’s crypt call that is meant to be kinda slow so it’s secure.
You’ve attached 2 profiling dumps. In the one about login crypt still takes quite some time but connecting to database takes almost the same time and that’s definitely wrong. Also autoloading seems to be kinda slow in your case. I suggest:
To check why database connection is slow. Is it local server? Do you have localhost in DSN? Is it resolving fast and w/o errors?
Do you have APC or Opcache installed? Is framework itself and application code are on the local FS?
I heard that nginx is very fast web proxy but it can only work with local file not like IIS can serve up a web site hosted on a network share and support Windows integrated security, etc.