Foren

Home » Liferay Portal » English » 3. Development

Kombinierte Ansicht Flache Ansicht Baumansicht
Threads [ Zurück | Nächste ]
toggle
Pierre Le roux
Change Image gallery path and use of Varnish
20. Juli 2012 02:24
Antwort

Pierre Le roux

Rang: New Member

Nachrichten: 9

Eintrittsdatum: 20. Juli 2012

Neue Beiträge

Hello,

I would like to use Varnish in front of Liferay in order to cache image_gallery files and deserve quicker than with my Tomcat.

I have few questions about doing this :
- By default, image gallery uses src="/image/image_gallery/xxx", so it stays on the same server. Is there a way to change (without overriding Liferay JSP) image path ? Did anybody already try it ? Is there any drawbacks i have to consider ?

- Did anybody already try to use Varnish with Liferay ? Can i really expect performance increase ?

Thanks for your help.

Regards,

Pierre
Juan Gonzalez
RE: Change Image gallery path and use of Varnish
20. Juli 2012 03:03
Antwort

Juan Gonzalez

LIFERAY STAFF

Rang: Liferay Legend

Nachrichten: 1967

Eintrittsdatum: 28. Oktober 2008

Neue Beiträge

I tried to use Varnish in Liferay 6.0.5 without much luck. Portal became much slower, but perhaps it was due to something misconfigured.

I don't think Varnish will increase performance a lot in Liferay, because Liferay has is own resource cache management (using HTTP headers) .
Hitoshi Ozawa
RE: Change Image gallery path and use of Varnish
21. Juli 2012 09:05
Antwort

Hitoshi Ozawa

Rang: Liferay Legend

Nachrichten: 7990

Eintrittsdatum: 23. März 2010

Neue Beiträge

What you outlined can be done with Apache httpd server too. With Apache, I just have to set not to transfer img request to liferay. Can do the same with css and javascript files too.

The downside is that when I do an update of liferay, I'll have to update transfer these files once again.
Ákos Gábriel
RE: Change Image gallery path and use of Varnish
11. September 2012 22:52
Antwort

Ákos Gábriel

Rang: Junior Member

Nachrichten: 33

Eintrittsdatum: 5. Oktober 2009

Neue Beiträge

I have different experiences. In our case (rather complex page, complex business functionality behind every page creation) Varnish increased the performance of the page dramatically. From 70 req/min and 2-3 sec page download time it changed to 1100-1400 req/min and 10-20ms page download time. Page is loading instantly. Resources are loaded in the same tcp stream so rendering is instant as well.

Every measurement tool confirms that.

The problem you might have faced is that Liferay fills the response with cookies and by default Varnish doesn't cache these pages. In fact you would cache static resources only. With careful selection of pages this caching can be enabled and you'll benefit from the increased performance.

As soon as I have some time I plan to summarize the experience in a howto page soon.
Pierre Le roux
RE: Change Image gallery path and use of Varnish
13. September 2012 07:51
Antwort

Pierre Le roux

Rang: New Member

Nachrichten: 9

Eintrittsdatum: 20. Juli 2012

Neue Beiträge

Hi

Thanks for all your answers. Akos, i'm looking forward for your results.

We are going to try with an NGINIX server. I don't know if Liferay can work with G-WAN. I just saw this benchmark
http://nbonvin.wordpress.com/2011/03/14/apache-vs-nginx-vs-varnish-vs-gwan/

About CDN, i activated http.cdn.host configuration and i think we are going to be quicker on browser to complete pages

I think our configuration is going to be :
- Front-end with NGINIX for both portal url and CDN url
- Backend with Tomcat

At first use of a resource, NGINIX is going to call Tomcat and cache result.
On next uses, NGINIX will serve directly the resource.

When i have results, i post here.

A question for you :
when you use varnish, do you also use CDN configuration ? If yes, did you achieve to configure Liferay to serve media resources (image_gallery in 6.0.5 or media gallery in 6.1) with CDN url ?


When i'm looking to image gallery in Liferay 6.0.5, i found this in view_image.jsp

1url='<%= (Validator.isNull(themeDisplay.getCDNHost()) ? themeDisplay.getPortalURL() : "") + themeDisplay.getPathImage() + "/image_gallery?uuid=" + image.getUuid() + "&groupId=" + image.getGroupId() + "&t=" + ImageServletTokenUtil.getToken(image.getLargeImageId()) %>'


As i declared a CDN, portalUrl is not included but i get "" instead of my CDN path.

In Liferay 6.1.0, all CDN references seem to have disapear in media gallery mecanism.

Can any anybody explain that ?