DaemonForums  

Go Back   DaemonForums > FreeBSD > FreeBSD Security

FreeBSD Security Securing FreeBSD.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 7th July 2008
mfaridi's Avatar
mfaridi mfaridi is offline
Spam Deminer
 
Join Date: May 2008
Location: Afghanistan
Posts: 282
Thanked 5 Times in 5 Posts
Default limit use memory by Apache

I use FreeBSD 6.2 and Apache ,
How I can limit use of memory by Apache.
I want with apache I can limit memory use and apache does no use all my memory when I have many request .
Reply With Quote
  #2   (View Single Post)  
Old 7th July 2008
Carpetsmoker's Avatar
Carpetsmoker Carpetsmoker is offline
Real Name: Martin
Old man from scene 24
 
Join Date: Apr 2008
Location: Eindhoven, Netherlands
Posts: 2,067
Thanked 198 Times in 156 Posts
Default

Set it in login.conf(5).

Code:
RESOURCE LIMITS
     Name            Type      Notes     Description
     coredumpsize    size                Maximum coredump size limit.
     cputime         time                CPU usage limit.
     datasize        size                Maximum data size limit.
     filesize        size                Maximum file size limit.
     maxproc         number              Maximum number of processes.
     memorylocked    size                Maximum locked in core memory size
                                         limit.
     memoryuse       size                Maximum of core memory use size
                                         limit.
     openfiles       number              Maximum number of open files per
                                         process.
     sbsize          size                Maximum permitted socketbuffer size.
     vmemoryuse      size                Maximum permitted total VM usage per
                                         process.
     stacksize       size                Maximum stack size limit.
__________________
UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things.
Reply With Quote
  #3   (View Single Post)  
Old 7th July 2008
mfaridi's Avatar
mfaridi mfaridi is offline
Spam Deminer
 
Join Date: May 2008
Location: Afghanistan
Posts: 282
Thanked 5 Times in 5 Posts
Default

Quote:
Originally Posted by Carpetsmoker View Post
Set it in login.conf(5).

Code:
RESOURCE LIMITS
     Name            Type      Notes     Description
     coredumpsize    size                Maximum coredump size limit.
     cputime         time                CPU usage limit.
     datasize        size                Maximum data size limit.
     filesize        size                Maximum file size limit.
     maxproc         number              Maximum number of processes.
     memorylocked    size                Maximum locked in core memory size
                                         limit.
     memoryuse       size                Maximum of core memory use size
                                         limit.
     openfiles       number              Maximum number of open files per
                                         process.
     sbsize          size                Maximum permitted socketbuffer size.
     vmemoryuse      size                Maximum permitted total VM usage per
                                         process.
     stacksize       size                Maximum stack size limit.
Thanks
but I want do this with Apache , I want when I have many request , these request do not use all of my memory and my system dose not hang

Last edited by mfaridi; 7th July 2008 at 07:46 AM.
Reply With Quote
  #4   (View Single Post)  
Old 7th July 2008
Carpetsmoker's Avatar
Carpetsmoker Carpetsmoker is offline
Real Name: Martin
Old man from scene 24
 
Join Date: Apr 2008
Location: Eindhoven, Netherlands
Posts: 2,067
Thanked 198 Times in 156 Posts
Default

Then set these settings (You probably want to set memoryuse for now, and leave the others alone) for the apache user, I believe it's www by default...
__________________
UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things.
Reply With Quote
  #5   (View Single Post)  
Old 8th July 2008
Darwimy Darwimy is offline
Port Guard
 
Join Date: Jun 2008
Location: Germany
Posts: 36
Thanked 2 Times in 2 Posts
Default

You may also need to limit the maximum number of connections Apache accepts, depending on the worker model you have chosen. Look at the output of 'top' and the RES value. Then set 'MaxClients = Available Memory / RES'.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Memory Not Detected jrs OpenBSD Installation and Upgrading 3 19th May 2009 05:50 PM
KDE4 uses a lot of memory... mdh FreeBSD General 6 21st October 2008 06:21 AM
dwindling memory chavez243 FreeBSD General 15 26th August 2008 04:06 PM
Memory cache graudeejs FreeBSD General 3 9th July 2008 03:27 AM
Apache data transfer limit cajunman4life General software and network 5 7th June 2008 05:13 PM


All times are GMT. The time now is 07:11 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick