How to reduce memory in Virtualmin when no website is accessed?

I have 21 wordpress websites in VPS and when apache is restarted, memory always remains less than 500MB (I have 2GB RAM total). But once I access all the websites it goes to around 1GB.

My problem is not going to 1GB RAM when accessed but it never comes back to 500MB after few minutes.

So I had to use a apahe and mysql restart cron job. Do you have any other alternative to avoid apache restart?

Thanks

It probably goes up due to Apache/PHP processes caching stuff and/or being started only upon first access to a site. I don’t think it’s a bad thing, since all subsequent accesses will be faster. Is there a particular reason why you want to keep memory consumption at 500 MB?

Simple. My VPS plan has 1GB RAM + 1GB burst RAM. So I am worried if my provider will warn me about it since it might affect other VPS’s.

I am wondering how hosting companies run their sites if all their hosted websites cache permanently like this.

Is there any way I can remove the apache cache after few minutes of non-use?

Is your VPS provider running OpenVZ?

If you are not sure try this from the shell as root “cat /proc/user_beancouters” if you get anything back your running OpenVZ.

If they are using OpenVZ, then try this, it has always greatly reduced memory usage for my apache installations.

https://www.intovps.com/client/knowledgebase/17/Memory-usage-seems-too-high-inside-a-VPS.html