Re: How do i cache a JSP on the proxy?

2001-06-11 Thread Eduard Witteveen

Kesav Kumar [EMAIL PROTECTED] wrote:
 Yes.  Oscache provides a proxy independent caching solution.  This is nice
 and once can have programtically control over the caching.  The only
 drawback(or good for some one) in the current implementation is all caching
 is memory based.  All the caching is done in memory and optionally file.
Well, this not lowering the number of requests on the application server. My goal is 
to lower the number of request on the application server, for the pages, which are 
made with jsp, but change hardly ever. 

I would like to use the proxy for this use, so that the application-server doesnt even 
get the requests. (We have a proxy there, so why not use it in our favour)

I know that oscache speeds up the whole thing :), since we agreed to use that one 
inside our jsp pages. (or i must miss something, that oscache is setting headers and 
stuff like that, but as far as i can see, it simply caches the body tag result.. )


-- 
Eduard Witteveen Systeem Ontwikkelaar
NOS Internet,  Mediacentrum Kamer 203
+31(0)356773059 http://www.omroep.nl/

Sed quis custodiet ipsos custodes? : The sixth Satire from Juvenal




Re: How do i cache a JSP on the proxy?

2001-06-11 Thread Johan Fredriksson
Title: RE: How do i cache a JSP on the proxy?



what about

%

 if ( 
(System.currentTimeMillis()/1000) % 15 
)
  counter = 0 
;
%

 That is, you first make sure 
that the time is rounded down to closest second and see if that is divisable by 
15, and then resetting counter

Or did I completely misunderstand you?

Johan


From: Kesav Kumar 

  To: Orion-Interest 
  Sent: Saturday, June 09, 2001 12:03 
  AM
  Subject: RE: How do i cache a JSP on the 
  proxy?
  
  Yes. Oscache provides a proxy independent caching 
  solution. This is nice and once can have programtically control over the 
  caching. The only drawback(or good for some one) in the current 
  implementation is all caching is memory based. All the caching is done 
  in memory and optionally file.
  Kesav Kumar Software Engineer 
  Voquette, Inc. 650 356 3740 
  mailto:[EMAIL PROTECTED] 
  http://www.voquette.com Voquette...Delivering Sound Information 
  -Original Message- From: Stan 
  Ng [mailto:[EMAIL PROTECTED]] 
  Sent: Friday, June 08, 2001 12:15 PM To: Orion-Interest Subject: Re: How do i cache 
  a JSP on the proxy? 
  This is slightly off-topic, but you may want to look into 
  OpenSymphony's OSCache module. It provides a 
  variety of caching options for JSP and it's been 
  working great for us here. 
  - Original Message - From: 
  "Eduard Witteveen" [EMAIL PROTECTED] To: "Orion-Interest" [EMAIL PROTECTED] 
  Sent: Friday, June 08, 2001 7:22 AM Subject: How do i cache a JSP on the proxy? 
   Hello,   I want to cache a jsp page on the proxy (apache).   My current setup is that i have 
  apache running on port 80, with following config:  VirtualHost 
  145.58.67.8  
  ServerName eduard.omroep.nl  ServerAlias eduard  ErrorLog /var/proxy/logs/errors 
   CustomLog /var/proxy/logs/access 
  common   ProxyPass / http://localhost:8080/ 
   CacheRoot "/tmp/proxy" 
   /VirtualHost  
   Furthermore the orionserver is running on port 8080, and 
  has the following 'special' settings:  frontend host="eduard.omroep.nl" port="80" / 
For the testing purposes i 
  have the following jsp page:  %@ page 
  session="false" %  %! int counter = 0; 
  %  %!  // return a time 
  back, which is +15 seconds..  public long 
  getLastModified(HttpServletRequest request) {  
  System.out.println("in last modified");  
  // return 15 seconds..  
  return System.currentTimeMillis() * (15 * 1000) ;  }  %   
  %  long seconds = 
  15;  long now = 
  System.currentTimeMillis();  long expires = now + (seconds * 
  1000);   response.setDateHeader("Expires", 
  expires);  
  System.out.println("in source.." + now + "-" + expires); 
   %  html 
   body  pThis 
  page was generated on time:%= now %br /  Will expire at:%= expires %br /  Expire time in seconds:%= seconds %br / 
   Count:%= counter++ %/p  /body  /html 
Everytime i request the 
  page, the counter is increased, but this is not what i 
  want. I want to increased at an maximum of 1 time in the 15 seconds. 
   Can somebody help me how to accomplish this, or possible 
  otherways to cache the jsp pages on the front 
  proxy?   
  greatings,   -- 
   Eduard Witteveen Systeem Ontwikkelaar  NOS Internet, Mediacentrum Kamer 203  +31(0)356773059 http://www.omroep.nl/  
   Sed quis custodiet ipsos custodes? : The sixth Satire 
  from Juvenal 


RE: How do i cache a JSP on the proxy?

2001-06-08 Thread Kesav Kumar
Title: RE: How do i cache a JSP on the proxy?





I think your getLastModified() logic is not proper. You are sending lastmodified time as current time*15 which means the lastmodification time is newer the proxy thinks that this page got changed. Try this logic 

public long getLastModified()
{
 File file = new File(getServletContext().getRealPath(jspfilename.jsp));
 return file.lastModified();
}




Kesav Kumar
Software Engineer
Voquette, Inc.
650 356 3740
mailto:[EMAIL PROTECTED]
http://www.voquette.com
Voquette...Delivering Sound Information



-Original Message-
From: Eduard Witteveen [mailto:[EMAIL PROTECTED]]
Sent: Friday, June 08, 2001 7:23 AM
To: Orion-Interest
Subject: How do i cache a JSP on the proxy?



Hello,


I want to cache a jsp page on the proxy (apache).


My current setup is that i have apache running on port 80, with following config:
 VirtualHost 145.58.67.8
  ServerName eduard.omroep.nl
  ServerAlias eduard
  ErrorLog /var/proxy/logs/errors
  CustomLog /var/proxy/logs/access common


  ProxyPass / http://localhost:8080/
  CacheRoot /tmp/proxy
 /VirtualHost


Furthermore the orionserver is running on port 8080, and has the following 'special' settings: 
 frontend host=eduard.omroep.nl port=80 /


For the testing purposes i have the following jsp page:
 %@ page session=false %
 %! int counter = 0; %
 %!
  // return a time back, which is +15 seconds..
  public long getLastModified(HttpServletRequest request) {
  System.out.println(in last modified);
  // return 15 seconds..
  return System.currentTimeMillis() * (15 * 1000) ;
  }
 %


 %
   long seconds = 15;
   long now = System.currentTimeMillis();
   long expires = now + (seconds * 1000);


   response.setDateHeader(Expires, expires);
  System.out.println(in source.. + now + - + expires);
 %
 html
 body
 pThis page was generated on time:%= now %br /
 Will expire at:%= expires %br /
 Expire time in seconds:%= seconds %br /
 Count:%= counter++ %/p
 /body
 /html


Everytime i request the page, the counter is increased, but this is not what i want. I want to increased at an maximum of 1 time in the 15 seconds.

Can somebody help me how to accomplish this, or possible otherways to cache the jsp pages on the front proxy? 


greatings,


-- 
Eduard Witteveen Systeem Ontwikkelaar
NOS Internet, Mediacentrum Kamer 203
+31(0)356773059 http://www.omroep.nl/


Sed quis custodiet ipsos custodes? : The sixth Satire from Juvenal





Re: How do i cache a JSP on the proxy?

2001-06-08 Thread Eduard Witteveen

Kesav Kumar [EMAIL PROTECTED] wrote:
 I think your getLastModified() logic is not proper.  You are sending
 lastmodified time as current time*15 which means the lastmodification time
 is newer the proxy thinks that this page got changed.  Try this logic 
Your correct, i made a terrible misunderstanding, but i can see in the logs that this 
method is never called, so this isnt a sollution to my problem.
-- 
Eduard Witteveen Systeem Ontwikkelaar
NOS Internet,  Mediacentrum Kamer 203
+31(0)356773059 http://www.omroep.nl/

Sed quis custodiet ipsos custodes? : The sixth Satire from Juvenal




Re: How do i cache a JSP on the proxy?

2001-06-08 Thread Stan Ng

This is slightly off-topic, but you may want to look into OpenSymphony's
OSCache module.  It provides a variety of caching options for JSP and it's
been working great for us here.


- Original Message -
From: Eduard Witteveen [EMAIL PROTECTED]
To: Orion-Interest [EMAIL PROTECTED]
Sent: Friday, June 08, 2001 7:22 AM
Subject: How do i cache a JSP on the proxy?


 Hello,

 I want to cache a jsp page on the proxy (apache).

 My current setup is that i have apache running on port 80, with following
config:
 VirtualHost 145.58.67.8
 ServerName eduard.omroep.nl
 ServerAlias eduard
 ErrorLog /var/proxy/logs/errors
 CustomLog /var/proxy/logs/access common

 ProxyPass / http://localhost:8080/
 CacheRoot /tmp/proxy
 /VirtualHost

 Furthermore the orionserver is running on port 8080, and has the following
'special' settings:
 frontend host=eduard.omroep.nl port=80 /

 For the testing purposes i have the following jsp page:
 %@ page session=false %
 %! int counter = 0; %
 %!
 // return a time back, which is +15 seconds..
 public long getLastModified(HttpServletRequest request) {
 System.out.println(in last modified);
 // return 15 seconds..
 return System.currentTimeMillis() * (15 * 1000) ;
 }
 %

 %
 long seconds = 15;
 long now = System.currentTimeMillis();
 long expires = now + (seconds * 1000);

 response.setDateHeader(Expires, expires);
 System.out.println(in source.. + now + - +  expires);
 %
 html
 body
 pThis page was generated on time:%= now %br /
 Will expire at:%= expires %br /
 Expire time in seconds:%= seconds %br /
 Count:%= counter++ %/p
 /body
 /html

 Everytime i request the page, the counter is increased, but this is not
what i want. I want to increased at an maximum of 1 time in the 15 seconds.
 Can somebody help me how to accomplish this, or possible otherways to
cache the jsp pages on the front proxy?

 greatings,

 --
 Eduard Witteveen Systeem Ontwikkelaar
 NOS Internet,  Mediacentrum Kamer 203
 +31(0)356773059 http://www.omroep.nl/

 Sed quis custodiet ipsos custodes? : The sixth Satire from Juvenal