roller-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "\(David\) Ming Xia" <david.ming....@ibol.biz>
Subject Ehcache on conditional Get
Date Mon, 24 May 2010 16:26:15 GMT
I learned that Ehcache supports 'conditional Get', but I haven't got a chance to look into
it.  I would truly appreciate if some one could shed some light on this topic, such as some
explanation, sample code, URL links, some thoughts or some hints.    
 
Thank you very much
 
 
David
 
--- On Mon, 5/24/10, (David) Ming Xia <david.ming.xia@ibol.biz> wrote:


From: (David) Ming Xia <david.ming.xia@ibol.biz>
Subject: Re: Roller's implementation on conditional Get
To: "John G. Moylan" <john@nuatech.net>
Cc: "Mailing List Apache Roller User" <user@roller.apache.org>, "Mailing List Apache
Roller Developer" <dev@roller.apache.org>
Date: Monday, May 24, 2010, 11:48 AM


Thank you John for your response.
 
   Roller's users frequently add new entries and update existing entries.  The trick is,
every time an entry added or updated, the parent weblog’s last-modified time will be updated
with current time, and this change is updated to the website table. 
 
   Roller caches web content for each requested page.  For each web request Roller queries
website table for the value of last-modified-time, and compare it against if-modified-since
in the http request header to evaluate the freshness of the cache.  So it seems that the
Roller website table is a point that we could not get around for the current design.  This
can be resolved only if Roller updates a time-out cache with last-modified-time each time
an entry added or updated, and the time-out cache, instead of the database table is checked
for each web page request.   
 
    Also, I would suggest that Roller only supports ‘conditional Get’ for text/html
content.  I would suggest Roller has a separate web component to hold all css, js and image
files, and that web component does not support ‘conditional Get’.  

  Talking about cache, it seems Roller is designed to use Ehcache (I only see jar and configuration
file, I did not see any corresponding api call.  Hmm…).   I don’t know very much about
memcached.  Could you give some comparison of memcached and ehcache?  

 
Thanks.
 
David     


--- On Mon, 5/24/10, John G. Moylan <john@nuatech.net> wrote:


From: John G. Moylan <john@nuatech.net>
Subject: Re: Roller's implementation on conditional Get
To: user@roller.apache.org, david.ming.xia@ibol.biz
Date: Monday, May 24, 2010, 7:59 AM



Hi David,


If you are concerned with performance then you should use memcached to cache JPA lookups.
You can also set explicit cache expires on your files. The last-modified issue you have specified
above is the same on most dynamic systems where last-modified support based on time or etag
is used.


J




On 21 May 2010 17:09, (David) Ming Xia <david.ming.xia@ibol.biz> wrote:






Hi, Everyone.

   This is about the implementation of conditional Get in Roller 4.0.1.

   As far as I see, Roller 4.0.1 supports conditional Get. Upon request, Roller checks the
‘If-Modified-Since’ field in the http header, and compares it with ‘Last-Modified’
attribute on server side.  And then either responds with a fresh page with status code 200,
or responds with a status code 304.     

  What I feel concerned is the part retrieving ‘Last-Modified’.  It is implemented in
org.apache.roller.weblogger.ui.rendering.servlets.PageServlet.  Attached you can see the
sequence diagram, which depicts the related class.  Every time a weblog entry is added or
changed, the  ‘last-modified’ field of corresponding website table will be updated. 
For any http request, PageServlet has to go through a JPA named query to get the ‘last-modified’
value.  That value is not cached in memory, and it is not kind of way that the entities float
across context (any how...).  So as far as I can see, it is hard query.  

   But for one page query, there are usually at least ten http query, including query for
text/html file, css file, js file, images, and so on.  So for 10000 simultaneous page requests,
there will be at least 100000 simultaneous database queries.  Furthermore, for any serious
production environment, database and application server are on different tiers and the connection
is encrypted with SSL.  So the picture to me it that, for limited concurrent users it is
fine, but when request volume goes up, the server may suddenly chocked up.
 
   I would appreciate if some one could respond and explain this, or provide some good
advices 
 
 
Thank you very much.
 
 
David



-- 
_____________
John G. Moylan


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message