Where can I preload classes to minimize "dirty RSS"

49 views
Skip to first unread message

sserdyuk

unread,
Nov 14, 2008, 8:31:33 AM11/14/08
to Phusion Passenger Discussions
Hi,

Due to templating engine I am using, I am seeing very sizable private
memory usage per pool instance and I'd like to optimize it. My believe
is that it is due to my templating engine loading after Passenger
"cans" the first instance, so every consecutive instance has to do
this initialization again.

I'd like to move that initialization sooner (basically preload), and I
need to know at which point Passengers "smart" spawner method is done
waiting for initialization.

Please advise.

Sergei.

Example of passenger memory stats:

# ./passenger-memory-stats
------------- Apache processes --------------
PID PPID Threads VMSize Private Name
---------------------------------------------
4650 8605 1 41.8 MB 1.0 MB /usr/sbin/httpd
4651 8605 1 41.9 MB 1.0 MB /usr/sbin/httpd
4654 8605 1 41.9 MB 1.0 MB /usr/sbin/httpd
4656 8605 1 41.8 MB 1.0 MB /usr/sbin/httpd
4658 8605 1 41.7 MB 0.9 MB /usr/sbin/httpd
4660 8605 1 41.9 MB 1.2 MB /usr/sbin/httpd
4661 8605 1 41.5 MB 0.7 MB /usr/sbin/httpd
4662 8605 1 41.7 MB 1.0 MB /usr/sbin/httpd
8605 1 1 41.3 MB 0.6 MB /usr/sbin/httpd
19453 8605 1 41.9 MB 0.8 MB /usr/sbin/httpd
19480 8605 1 41.8 MB 0.8 MB /usr/sbin/httpd
19481 8605 1 41.5 MB 0.8 MB /usr/sbin/httpd
### Processes: 12
### Total private dirty RSS: 10.83 MB

--------- Passenger processes ---------
PID Threads VMSize Private Name
---------------------------------------
4646 14 5.7 MB 0.3 MB /opt/ruby-enterprise-1.8.6-20080624/
lib/ruby/gems/1.8/gems/passenger-2.0.1/ext/apache2/
ApplicationPoolServerExecutable 0 /opt/ruby-enterprise-1.8.6-20080624/
lib/ruby/gems/1.8/gems/passenger-2.0.1/bin/passenger-spawn-server /
opt/ruby-enterprise-1.8.6-20080624/bin/ruby /tmp/passenger_status.
8605.fifo
4647 1 11.5 MB 6.1 MB Passenger spawn server
27711 1 27.7 MB 16.9 MB Passenger FrameworkSpawner: 2.0.2
27712 1 70.1 MB 15.5 MB Passenger ApplicationSpawner: /home/
rails/apps/tbn/releases/20081112203524
27715 1 87.5 MB 35.8 MB Rails: /home/rails/apps/tbn/releases/
20081112203524
27757 1 83.3 MB 29.6 MB Rails: /home/rails/apps/tbn/releases/
20081112203524
27762 1 83.3 MB 29.6 MB Rails: /home/rails/apps/tbn/releases/
20081112203524
### Processes: 7
### Total private dirty RSS: 133.92 MB

Hongli Lai

unread,
Nov 14, 2008, 9:35:17 AM11/14/08
to phusion-...@googlegroups.com
sserdyuk wrote:
> Hi,
>
> Due to templating engine I am using, I am seeing very sizable private
> memory usage per pool instance and I'd like to optimize it. My believe
> is that it is due to my templating engine loading after Passenger
> "cans" the first instance, so every consecutive instance has to do
> this initialization again.
>
> I'd like to move that initialization sooner (basically preload), and I
> need to know at which point Passengers "smart" spawner method is done
> waiting for initialization.
>
> Please advise.
>
> Sergei.

If you preload your templates in environment.rb, then the resulting
allocated memory will be eligible for copy-on-write optimizations.

--
Phusion | The Computer Science Company

Web: http://www.phusion.nl/
E-mail: in...@phusion.nl
Chamber of commerce no: 08173483 (The Netherlands)

Reply all
Reply to author
Forward
0 new messages