Re: [Catalyst] Sharing session and login data

2007-02-28 Thread Jeffrey Ng

we have just improved our session implementation. instead of storing
our session table in mysql database, we stored them in memcache. we
got immense speed improvement from the change. memcache is completely
separate from catalyst, may be it will work for you too.

On 2/28/07, Tiziano Faion [EMAIL PROTECTED] wrote:

Hi All,
I've got a trouble in sharing data session betweeb two catalyst
applications.
The First one is an intranet software where user log in.
The second one is a production monitoring software.
In intranet i've a link that opens, in the same window, the second app.
Two apps shares same database for user and roles.
Now..
If i login into intranet and i go to the second app. i lose my login and
role information.
I hoped that setting the same path for session in yaml  for both
applications would be enough but...
Any suggestion? Link?
Thanks in advance
Tiziano
--
Tiziano Faion [EMAIL PROTECTED]


___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/




--
Jeffrey Ng
CEO, Zorpia.com

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Session problems with IE and cookies

2007-02-28 Thread Jeffrey Ng
(session expired) [debug] Found sessionid
  cb30ab14db722929594b6ec6e4f35bc28895284f in cookie [debug]
  Successfully authenticated user '[EMAIL PROTECTED]'.
  [debug] Redirecting to https://myapp/signin;
 
  ___
  List: Catalyst@lists.rawmode.org
  Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
  Searchable archive:
  http://www.mail-archive.com/catalyst@lists.rawmode.org/
  Dev site: http://dev.catalyst.perl.org/
 

 ___
 List: Catalyst@lists.rawmode.org
 Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
 Searchable archive:
 http://www.mail-archive.com/catalyst@lists.rawmode.org/
 Dev site: http://dev.catalyst.perl.org/



___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/




--
Jeffrey Ng
CEO, Zorpia.com

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Sharing session and login data

2007-02-28 Thread Jeffrey Ng

right! thanks for reminding. we probably will put it on a separate
dedicated memcache server then.

On 2/28/07, Perrin Harkins [EMAIL PROTECTED] wrote:

On 2/28/07, Jeffrey Ng [EMAIL PROTECTED] wrote:
 we have just improved our session implementation. instead of storing
 our session table in mysql database, we stored them in memcache.

Memcached does things like silently drop your data when it runs out of
room.  If the daemon stops for any reason, all of your sessions are
instantly gone (unlike a database where they are safely on disk and
you can restart it).  It is designed to be unreliable storage, since
it's a cache and not a database.

Some sites can get away with it, because they just don't care if they
use all their users' sessions.  Just be sure that your site is one of
those before your start putting your sessions into lossy storage.

- Perrin

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/




--
Jeffrey Ng
CEO, Zorpia.com

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Re: memory usage of mod_perl process

2007-02-09 Thread Jeffrey Ng

On 2/9/07, Peter Edwards [EMAIL PROTECTED] wrote:


Are you hitting the database very hard?  Complex joins?  Are your pages
very complex?
No, it's a fairly simple backend processor that mostly handles XML
transactions for a Flash frontend. There are some XHTML admin pages
generated with Template::Toolkit (and so are slower) but they are rarely
hit.

For the database a typical run hits a session table, user table, writes a
log table and reads data from a couple of other tables. No complex joins.
The app handles user registration, some league tables, polls, competition
entries and users submitting images that are approved and shown on the
site.

In this case I knew there was the potential for a huge number of users so
went for a lightweight approach that could easily be tuned further. For a
more complex app with fewer peak users I'd have used Catalyst.



what other light weight approach would you go for?
so are you saying in general catalyst is pretty heavy, and its not for site
with many concurrent users?...

Regards, Peter

www.dragonstaff.com



___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive:
http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/





--
Jeffrey Ng
CEO, Zorpia.com
___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Re: memory usage of mod_perl process

2007-02-09 Thread Jeffrey Ng

On 2/9/07, Oliver Gorwits [EMAIL PROTECTED] wrote:


Jeffrey Ng wrote:
 I am the coworker of Fayland who posted the topic memory usage of
 mod_perl process.

 Our company has invested quite some time on migrating our perl code to
 catalyst (more than half year of time by 7 programmers). However, I am
 starting to worry that moving to catalyst is causing too much overhead
 for our processes and thus severely slowing down our site.

Take a good, hard look at what's coming out of your web servers. Install
a Squid farm in front of the servers and let them cache anything
suitable...



yes we are thinking about that now. however, we are not sure how to update
the cache we we want to refresh the page. i guess we will adjust the http
header when we want to flush it? how does squid know if our page is
refreshed when it has already cached our page though?...

letting Apache fork just to serve an image can be really damaging to

performance. Double check the HTTP headers on all outgoing pages include
proper caching instructions for Squid so it'll work properly.



yah, i know that. our catalyst apache servers are only for serving dynamic
pages. however, there are some ajax javascript files we have to host on the
exact same subdomain to work. i still feel that those javascript files are
wasting our apache resources. for ajax javascript like that, how should i
redirect the load to other servers while maintaining the same subdomain in
the location bar? i tried to use mod_rewrite, and seems like its even slower
than serving the file itself!

Even whole store-front pages from Catalyst sites can usually be cached

well, because users don't have state at that point, and perhaps most
hits are to your homepage (so remember to let Squid know your homepage
is cacheable, in the headers).

Remember mod_perl can be quite leaky as well, so kill off the child
processes after they've served a few requests. Oh, and switch off
hyperthreading if you have dual P4/Xeon boxes, and use PreFork MPM.

There's more info in the slides from this LPW talk:


http://london.pm.org/lpw/talks/2006/dave_hodgkinson-mod_perl_server_farm_architecture_done_right.pdf

HTH,

oliver.


___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive:
http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/





--
Jeffrey Ng
CEO, Zorpia.com
___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Re: memory usage of mod_perl process

2007-02-09 Thread Jeffrey Ng

On 2/10/07, Tony Losey [EMAIL PROTECTED] wrote:


On Fri February 9 2007 12:53 pm, Jeffrey Ng wrote:
 On 2/9/07, Oliver Gorwits [EMAIL PROTECTED] wrote:
  Jeffrey Ng wrote:
   I am the coworker of Fayland who posted the topic memory usage of
   mod_perl process.
  
   Our company has invested quite some time on migrating our perl code
to
   catalyst (more than half year of time by 7 programmers). However, I
am
   starting to worry that moving to catalyst is causing too much
overhead
   for our processes and thus severely slowing down our site.
 
  Take a good, hard look at what's coming out of your web servers.
Install
  a Squid farm in front of the servers and let them cache anything
  suitable...

 yes we are thinking about that now. however, we are not sure how to
update
 the cache we we want to refresh the page. i guess we will adjust the
http
 header when we want to flush it? how does squid know if our page is
 refreshed when it has already cached our page though?...


You can call the PURGE command on squid. You must allow this in the conf
and
put in place the proper acl to allow it. I believe you can call squid with
the following options to force a purge of the cache of a given page.

-m PURGE http://mywebsite.com/index.html

We are not using catalyst in production yet so we don't have squid running
in
front of any catalyst apps. We do however have it running in front of some
python/zope/plone sites. There are plugins that handle the purging
directly
for us. We just provide the url to purge to a method that handles the
purge
when needed.



right! i just googled and found
http://search.cpan.org/~sock/Net-Squid-Purge-0.1/
that cpan module should be able to purge the cached.


letting Apache fork just to serve an image can be really damaging to

  performance. Double check the HTTP headers on all outgoing pages
include
  proper caching instructions for Squid so it'll work properly.

 yah, i know that. our catalyst apache servers are only for serving
dynamic
 pages. however, there are some ajax javascript files we have to host on
the
 exact same subdomain to work. i still feel that those javascript files
are
 wasting our apache resources. for ajax javascript like that, how should
i
 redirect the load to other servers while maintaining the same subdomain
in
 the location bar? i tried to use mod_rewrite, and seems like its even
 slower than serving the file itself!

 Even whole store-front pages from Catalyst sites can usually be cached

  well, because users don't have state at that point, and perhaps most
  hits are to your homepage (so remember to let Squid know your homepage
  is cacheable, in the headers).
 
  Remember mod_perl can be quite leaky as well, so kill off the child
  processes after they've served a few requests. Oh, and switch off
  hyperthreading if you have dual P4/Xeon boxes, and use PreFork MPM.
 
  There's more info in the slides from this LPW talk:
 
 
 
http://london.pm.org/lpw/talks/2006/dave_hodgkinson-mod_perl_server_farm_
 architecture_done_right.pdf
 
  HTH,
 
  oliver.
 
 
  ___
  List: Catalyst@lists.rawmode.org
  Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
  Searchable archive:
  http://www.mail-archive.com/catalyst@lists.rawmode.org/
  Dev site: http://dev.catalyst.perl.org/

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive:
http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/





--
Jeffrey Ng
CEO, Zorpia.com
___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


[Catalyst] Re: memory usage of mod_perl process

2007-02-08 Thread Jeffrey Ng

I am the coworker of Fayland who posted the topic memory usage of mod_perl
process.

Our company has invested quite some time on migrating our perl code to
catalyst (more than half year of time by 7 programmers). However, I am
starting to worry that moving to catalyst is causing too much overhead for
our processes and thus severely slowing down our site.

I remember the memory usage of each process before catalyst was around 25Mb.
And now the new code is using around 90MB as fayland said. During peak hour,
our servers were able to handle 30+ requests per sec before catalyst
upgrade. Now we are only able to handle around 10 requests per sec.

As a result, the response time of the site is much slower after the upgrade.
it takes at least 2 sec for the browser to start responding during non-peak
hours.

Here's the memory stats for a typical process:

Memory Usage (in bytes):

 Size   :   97107968 (92.6M)
 Share  :6012928 ( 5.7M)
 VSize  :   97107968 (92.6M)
 RSS:   85131264 (81.2M)

Memory Segments Usage (in bytes):

 Text   : 253952 ( 248K)
 Shlib  :  0 (   0K)
 Data   :   78696448 (75.1M)
 Stack  :  0 (   0K)



I have read practical mod_perl. I tried to preload many of our modules in
startup.pl. But the shared memory value doesnt change at all. Also, doesnt
5.7M shared memory usage sound too small comparing to the 92.6M total size?

I wonder how much is your shared memory? Is the memory overhead of catalyst
huge? Is catalyst inherently slow?

--
Jeffrey Ng
___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Re: memory usage of mod_perl process

2007-02-08 Thread Jeffrey Ng

On 2/9/07, Perrin Harkins [EMAIL PROTECTED] wrote:


On 2/8/07, Jeffrey Ng [EMAIL PROTECTED] wrote:
 I have read practical mod_perl. I tried to preload many of our modules
in
 startup.pl. But the shared memory value doesnt change at all. Also,
doesnt
 5.7M shared memory usage sound too small comparing to the 92.6M total
size?

You're not looking at the right thing there.  This is not actual
shared memory, but rather copy-on-write sharing.  It will never show
in your SHARE section.  On versions of Linux with a 2.6 kernel, you
can use the techniques in Apache::SizeLimit to get a sesne of how much
sharing is going.  This doesn't work with older kernels.

A reliable way to tell if your sharing is improved is to start up
apache without preloading and look at the available memory from
free, and then put in the preloading and restart apache and check it
again.  You should have more free memory after preloading, allowing
you to run more processes.



when i run this free test, should i run it on the live server, or on a
test server with single process apache mode?

here's the result on a live server:

total   used   free sharedbuffers cached
Mem:   415097226540161496956  0  275481313344
-/+ buffers/cache:13131242837848
Swap:  8385912   69208378992


and here's the top results on one of the server:

top - 14:21:55 up 144 days,  9:30,  0 users,  load average: 19.30, 18.65,
12.27
Tasks:  87 total,   1 running,  86 sleeping,   0 stopped,   0 zombie
Cpu(s): 69.6% us,  1.3% sy,  0.0% ni, 27.7% id,  0.0% wa,  0.2% hi,  1.2% si
Mem:   4150972k total,  2623968k used,  1527004k free,27380k buffers
Swap:  8385912k total, 6920k used,  8378992k free,  1312832k cached

 PID USER  PR  NI  VIRT  RES  SHR S %CPU %MEMTIME+  COMMAND
26343 apache15   0 97196  83m 6236 S 10.0  2.1   0:08.69 httpd
26340 apache15   0 94740  81m 5896 S  7.8  2.0   0:07.62 httpd
26315 apache15   0 95552  81m 5896 S  7.4  2.0   0:08.31 httpd
26326 apache15   0 94836  81m 5868 S  7.4  2.0   0:08.17 httpd
26371 apache15   0 95496  81m 5872 S  7.4  2.0   0:08.21 httpd


I set the maxserver as 60.
Our CPU load is extremely high. But the actual RAM usage is not high at all.
we are using only 260 gig out of 400 gig. From our top results, does it look
like the memory usage of our processes is the bottleneck?

- Perrin


___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive:
http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/





--
Jeffrey Ng
CEO, Zorpia.com
___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/