OpenVZ Forum


Home » General » Support » Memory needs / Special requirements for OS inside container?
Memory needs / Special requirements for OS inside container? [message #35032] Sun, 22 February 2009 22:36 Go to next message
Fork is currently offline  Fork
Messages: 1
Registered: February 2009
Junior Member
Hi,

I'm slightly irritated by the memory usage of the applications inside a container and wonder if I did anything wrong while installing the OS.

I used to run my webserver on a real machine and even with 150 httpd processes (Apache prefork, plus MySQL server, OpenSSH and a few smaller ones), total memory usage barely reaches 128 MByte. The machine has 256 MByte RAM plus 128 MByte swap. Never had an issue with that in the past years.

A few weeks ago I moved the whole system into an OpenVZ container provided by my hoster. In this container, I frequently run into the 768 MByte barrier, cause just some 35 httpd processes eat up all the memory.

Using top -u httpd, the httpd processes' data looks almost the same on both systems:
  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
24478 httpd     25  10 27700 9168 2728 S    0  1.2   0:00.03 httpd
[..]

Looks to me like the VIRT ain't as virtual inside a container as it is on a real system.

Now, I did not use the OS templates my hoster provided, since I always felt comfortable with my LFS (linuxfromscratch). Using the HyperVM console, I deleted the existing directories created by the Slackware template and then untar'ed my own LFS "template" (not an OpenVZ template, just the same clean copy I used for my old server, too).
The system boots and runs just fine, except for this memory issue.

Before I start bugging my hoster about an OS he didn't provide, I'd like to know if there is anything I need to take care of when compiling the system libraries? Is there e.g. any difference between compiling glibc for a real machine and doing so for a container?
The OpenVZ wiki guides that show how to create an OS template don't seem to indicate that anything special needs to be taken care of, but I'm not sure if I missed something.

Or is there some other explanation for the memory needs inside a container?

Thanks!

Output from uname -a: Linux ka 2.6.18-12-fza-686 #1 SMP Sun May 18 12:30:42 CEST 2008 i686 pentium4 i386 GNU/Linux
Re: Memory needs / Special requirements for OS inside container? [message #38355 is a reply to message #35032] Thu, 10 December 2009 20:00 Go to previous message
mustardman is currently offline  mustardman
Messages: 91
Registered: October 2009
Member
OpenVZ containers have some included httpd tuning for low memory. Perhaps yours has been changed or needs to be or it's not working for some reason. Here is what mine looks like. I don't recall changing it.

/etc/httpd/conf.d/swtune.conf



# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# ServerLimit: maximum value for MaxClients for the lifetime of the server
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule prefork.c>
ServerLimit 256
MaxClients 10
</IfModule>

# worker MPM
# StartServers: initial number of server processes to start
# MaxClients: maximum number of simultaneous client connections
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule worker.c>
StartServers 1
MaxClients 10
MinSpareThreads 1
MaxSpareThreads 4
ThreadsPerChild 25
MaxRequestsPerChild 0
</IfModule>


[Updated on: Thu, 10 December 2009 20:05]

Report message to a moderator

Previous Topic: OpenVZ HWNODE becomes unresponsive
Next Topic: Update a container from the client side.. Is posible?
Goto Forum:
  


Current Time: Tue Jul 16 23:24:45 GMT 2024

Total time taken to generate the page: 0.02961 seconds