Hi,

I've just disabled the apc cache under the routing: section in
factories.yml and here are some stats:

Total Incl. Wall Time (microsec):       3,082,027 microsecs

Then, ordered by number of calls

sfRoute::mergeArrays    56,978  17.2%   394,924         12.8%   394,924         
12.8%
is_array        47,957  14.4%   54,068  1.8%    54,068  1.8%
array_diff_key  28,556  8.6%    78,547  2.5%    78,547  2.5%
sfRoute::getDefaultParameters   28,489  8.6%    63,969  2.1%    63,969
2.1%
sfRoute::setDefaultParameters   28,425  8.6%    85,397  2.8%    85,397
2.8%
sfRoute::matchesParameters      28,422  8.6%    1,684,034       54.6%   
1,028,030
33.4%
sfRequestRoute::matchesParameters       27,333  8.2%    1,889,048       61.3%
259,590         8.4%
sfObjectRoute::matchesParameters        27,333  8.2%    2,424,934       78.7%
379,442         12.3%
sfObjectRoute::convertObjectToArray     19,363  5.8%    156,451         5.1%
136,329         4.4%
preg_match      16,348  4.9%    59,968  1.9%    59,968  1.9%
array_keys      14,230  4.3%    26,658  0.9%    26,658  0.9%

So, sfObjectRoute::matchesParameters is called 27,333 times taking
2,424,934 microseconds which it ~78% of the total time for the request

There are only 66 calls to url_for():

sfPatternRouting::generate      67      0.0%    2,934,777       95.2%   2,917   
0.1%
sfWebController::genUrl         67      0.0%    2,942,070       95.5%   3,345   
0.1%
url_for         66      0.0%    2,882,401       93.5%   1,436   0.0%
url_for1        66      0.0%    2,879,410       93.4%   1,336   0.0%

all the calls to url_for() collectively take 2,882,401 microseconds
~93% of total request time.

On Oct 30, 2:40 pm, "arri...@gmail.com" <arri...@gmail.com> wrote:
> Hi,
>
> We use APC as the opcode cache, so all *.php files are cached by
> default - we had to increase the default apc.max_file_size to alow it
> to cache the routing cache file (config_routing.yml.php)
>
> We also use the variable cache of APC to speed up routing matches. We
> have this entry in factories.yml under routing:
>
>       lookup_cache_dedicated_keys:      true
>       cache:
>         class: sfAPCCache
>         param:
>           automatic_cleaning_factor: 0
>           lifetime:                  1800
>
> As I said, the opcode cache pretty much solves the route loading speed
> for us, our issue is the route matching speed without the above cache
> setting.
>
> here is our apc.ini
>
> extension=apc.so
> apc.shm_size=256
> apc.ttl=600
> apc.gc_ttl=300
> apc.user_ttl=600
> apc.max_file_size=5M
> apc.num_files_hint=6000
>
> On Oct 30, 12:49 pm, David Ashwood <da...@inspiredthinking.co.uk>
> wrote:
>
> > I ran some tests last night on the old performance framework before
> > downloading the latest version and starting to migrate my changes into
> > the code - this is only the compression based changes - nothing
> > intelligent happening yet:
>
> > # Creating routing yml with 1000 routes
> > # creating 1.2 config
> > # time: 0.286042, memory: 1792.00kb
> > # creating 1.3 config
> > # time: 0.586565, memory: 7680.00kb
> > # creating 1.3a config
> > # time: 0.639807, memory: 3328.00kb
> > # loading 1.2 config
> > # time: 0.113459, memory: 4096.00kb
> > # loading 1.3 config
> > # time: 0.648253, memory: 23808.00kb
> > # loading 1.3a config
> > # time: 0.409712, memory: 6912.00kb
> > # searching 1.2 route
> > # time: 0.205716, memory: 0.00kb
> > ok 1
> > # searching 1.3 route
> > # time: 0.004365, memory: 0.00kb
> > ok 2
> > # searching 1.3a route
> > # time: 0.004388, memory: 0.00kb
> > ok 3
> > FileSize with 1.3 Default: 2126812 routing.php
> > FileSize with 1.3a : 1099505  routing.php
>
> > This is only from targeting compression - I've not looked at any kind
> > of intelligent mapping/loading yet.  The splArray out of habit (I've
> > been working on a project recently where the splDatastructures are
> > used).  I'll ensure the next version is compatible.
>
> > How are you using/how have you configured the APC with sf?
> > I ask as I've been playing with some autodetection code - the intention
> > being to use it if it's available - otherwise to fall back to more
> > conventional approaches.
>
> > On Fri, 2009-10-30 at 05:37 -0700, arri...@gmail.com wrote:
> > > Hi,
>
> > > Here is output from my run of the tests - I cannot run david's
> > > benchmark as splFixedArray is not available in my php build, though
> > > SPL is shown as available in php_info(). I'm running php 5.2.11.
>
> > > Re: config/cache - in 1.3 our config_routing.yml.php is 2,054,492
> > > bytes and consists of 628 routes. These are mostly propel routes.
> > > However, with APC opcode caching we find this loads very quickly (last
> > > time I benchmarked it was something like 0.06 seconds) Our problem is
> > > matching routes - if we have a page with 50 or so links, the majority
> > > of the time is spent matching the route (something like 1 second out
> > > of total request time of 1.2 seconds) If we enable the APC variable
> > > cache and lookup_dedicated_cache_keys once the route is matched, the
> > > performance is ok, however we have a lot of route variations and I can
> > > see this using a large amount of RAM. We cannot run without this cache
> > > as performance is just too slow. Been a while since I looked at this,
> > > but can put together some stats if it's useful?
>
> > > [an...@cysrln03-dev-andyr-vm]~/projects/trunk-local-fs/lib/vendor/
> > > symfony/test/routing_performance% php routing_performance.php 1.2|grep
> > > "^#"
> > > # testing patch 1.2
> > > # This is equivalent to the latest version from the 1.2 branch.
> > > # Creating routing yml with 1500+ routes
> > > # 1.2 Routing - Creating Config
> > > # time: 1.713294, memory: 2304.00kb
> > > # 1.2 Routing - Loading Config
> > > # time: 0.193375, memory: 10240.00kb
> > > # 1.2 Routing - Searching Routes 10 times
> > > # 1.2 Routing - Generating Routes 20 times
> > > # time: 1.633093, memory: 3328.00kb
> > > # 1.2 Routing - Real World Test - Accumulated data
> > > # time: 1.826847, memory: 13568.00kb
> > > # file: 211.00kb
> > > [an...@cysrln03-dev-andyr-vm]~/projects/trunk-local-fs/lib/vendor/
> > > symfony/test/routing_performance% php routing_performance.php david|
> > > grep "^#"
> > > # testing patch david
> > > # Creating routing yml with 1500+ routes
> > > # david Routing - Creating Config
> > > PHP Fatal error:  Class 'splFixedArray' not found in /home/andyr/
> > > projects/trunk-local-fs/lib/vendor/symfony/test/routing_performance/
> > > david/sfRoutingConfigHandlerNew.class.php on line 84
> > > [an...@cysrln03-dev-andyr-vm]~/projects/trunk-local-fs/lib/vendor/
> > > symfony/test/routing_performance% php routing_performance.php fabian|
> > > grep "^#"
> > > # testing patch fabian
> > > # Creating routing yml with 1500+ routes
> > > # fabian Routing - Creating Config
> > > # time: 2.712385, memory: 9472.00kb
> > > # fabian Routing - Loading Config
> > > # time: 0.421317, memory: 9216.00kb
> > > # fabian Routing - Searching Routes 10 times
> > > # fabian Routing - Generating Routes 20 times
> > > # time: 0.814632, memory: 0.00kb
> > > # fabian Routing - Real World Test - Accumulated data
> > > # time: 1.236377, memory: 9216.00kb
> > > # file: 1899.08kb
>
> > > Thanks,
> > > Andy.
>
> > > On Oct 29, 5:14 pm, Fabian Lange <fabian.la...@symfony-project.com>
> > > wrote:
> > > > Hi David,
> > > > feel free to send me patches for our performance test suite.
> > > > I will incorporate them until i find a way to give access to everybody.
>
> > > > So if you have something new i will include it.
>
> > > > Ideally we have then some kind of incubation of a new way for routing
> > > > to be configured. And we can benchmark them.
>
> > > > So that before release 1.3 we can find a good performing solution.
> > > > To be included in 1.3 i would like to accept only "small" backwards
> > > > compatible changes that have a big net effect.
>
> > > > Fabian
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony developers" group.
To post to this group, send email to symfony-devs@googlegroups.com
To unsubscribe from this group, send email to 
symfony-devs+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/symfony-devs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to