eZ Community » Forums » eZ Publish 5 Platform » esi block with user information slows...
expandshrink

esi block with user information slows down whole app

esi block with user information slows down whole app

Thursday 11 September 2014 9:09:53 am - 3 replies

Most web pages contain a small block with user-specific information: a login name, link to profile etc. 

I think it is common practice to place this information in esi block without caching (response set as private) whilst main content of the page cached as public.

I found out that this private esi block causes to very slow response generation.

For me request processing time is about 300 ms and real response generations takes 500 ms.

Does somebody has expiriense with private subrequests in esi rendered blocks? Is it always that slow or maybe there is a bottleneck i didn't find?

 

Thursday 11 September 2014 11:09:29 am

Hi Andrey

Well it really depends on what you do with your controller blunk.gif Emoticon. Moreover, never caching it is not a good idea IMHO. Better cache it, but vary by cookie (like in the DemoBundle). And you can also use Hinclude instead of ESI, to load this part asynchronously (again like in the DemoBundle).

Thursday 11 September 2014 6:13:20 pm

Quote from Jérôme Vieilledent :

Well it really depends on what you do with your controller

The thing is that controller is ultra thin. It just renders empty template. But even in this case subrequest takes about 400 ms in production mode. 

It seems that it possible to use non cached subrequests just with render_hinclude.

Friday 12 September 2014 11:19:08 am

Apologies in advance, this reply might not be that helpful...

 

I had a similar problem on the site I work on - shared public caches were causing usernames to be shared between users. Setting the caches to private fixed that problem.

 

On our site we actually store a vast amount of user information for analytics tracking. To save querying the user object on every page load, I add the data I need to the symfony session on login. That speeds things up a lot.

 
 
$session = $this->container->get( 'session' );
 
$session->set( $key, $value );
 
// then
 
$session->get( $key);

 

 

Now the bad news: our login handler is completely custom. It's a few thousand lines of code written by another dev. I understand very little of it, so I can't tell you where you would need to set this data in a vanilla ez install. Sorry about that.

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from