LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-06-2010, 01:53 AM   #16
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled

fernfrancis -

Q: Why are you running "swapon" or "swapoff".
STRONG SUGGESTION: if you don't need to, then don't!

Q: Could you run "top" occasionally, sort by memory, and post the output?
I'm curious if the "custom process" ranks high in memory usage. Or if you can actually see it growing.

Q: Could you please clarify exactly how "squid" is involved? Other than the fact that it "hangs" periodically?

Q: Have you looked at the squid logs?
Could you post the last several messages before the last hang occurred?

Thank you in advance!
 
Old 12-06-2010, 02:31 AM   #17
fernfrancis
Member
 
Registered: Feb 2009
Location: Goa(India)-Sharjah(UAE)
Distribution: RHEL,centos,fedora,ubuntu
Posts: 229

Original Poster
Rep: Reputation: 18
ok its like this
we have squid and mysql installed
the acl for IP addresses is stored in the database , so what exactly happens is that this application gathers the acl for that IP and passes on to squid. which does the needful.

when the system runs out of memory then database calls are not made which results in the above situation

the process is squid_acl which makes use of physical ram as well as swap memory

so thats i was asking if i run swapoff and swapon will it affect users



so
 
Old 12-06-2010, 03:28 AM   #18
gd2shoe
Member
 
Registered: Jun 2004
Location: Northern CA
Distribution: Debian
Posts: 835

Rep: Reputation: 49
Quote:
Originally Posted by fernfrancis View Post
the process is squid_acl which makes use of physical ram as well as swap memory

so thats i was asking if i run swapoff and swapon will it affect users
???

No application should ever use swapspace directly. The OS should manage swapped pages on its behalf.

As an aside, I think several people here are itching to know:
Code:
cat /proc/sys/vm/swappiness
 
Old 12-06-2010, 08:14 AM   #19
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181
Quote:
Originally Posted by fernfrancis View Post
6GB ram
Quote:
Originally Posted by fernfrancis View Post
yes i have 12gb of ram available
The second quote above was a typo? You meant 12GB of swap? Or 12GB swap plus ram? Or what?

Quote:
Originally Posted by fernfrancis View Post
one the application reaches 5.3 gb of physical RAM then the application makes use of the swap memory
You mean 5.3GB as reported in the RES column of top (or equivalent value from some other tool)? That is very reasonable for starting to use some swap.

Quote:
i have 2 swap partition each of 6gb, so when 6 gb of one swap is utilised then the system hangs
What did you mean by "so" or maybe what did you mean by "6 gb of one swap is utilised"? When almost all of both swap partitions is utilized, the system would be likely to hang. Why are you focusing on one swap partition? Are they set to equal priority so they are used about equally? Or is one used preferentially?

Quote:
if i use the command swapoff -a wait for a while and then swapon -a
will it affect the running of the application

What do you hope to accomplish with swapoff?

I'm not sure what that does when the swap you are turning off is required. But it certainly does nothing helpful. The two most plausible outcomes are the swapoff command itself fails because the swap space cannot be freed, or it triggers the OOM killer and destroys your big application.
 
Old 12-06-2010, 03:16 PM   #20
salasi
Senior Member
 
Registered: Jul 2007
Location: Directly above centre of the earth, UK
Distribution: SuSE, plus some hopping
Posts: 4,059

Rep: Reputation: 883Reputation: 883Reputation: 883Reputation: 883Reputation: 883Reputation: 883Reputation: 883
Quote:
Originally Posted by fernfrancis View Post
k thanx a lot i was thinking that may be swap must be in use always.
You are distinguishing between 'in use' and 'available'; there is no requirement that swap must be in use, but there may be a requirement that some is available, depending.

Quote:
anyways one of my application on this server is eating a lot of memory that y i needed to check this . is there a way to check memory leak and how do i fix this i am not a developer
How did you determine that the app is eating a lot of memory? many of the programs of the top family will do this as will darkstat, kde system monitor (although you'd run that in client-server mode, with the display on a different machine from your server) and all of the monit/munin type stuff. Whatever you did, you do something similar infrequently and look whether something is growing gradually.

Quote:
this application he has written reads the database value of the IP and the access that IP has and provides the info to squid which does the necessary stuff
Mysterious; what is this 'necessary stuff'? Superficially, it doesn't seem necessary to be feeding squid with any IP info to squid; squid compiles a list of stuff that it has accessed and works just fine without any external process feeding it stuff,

Maybe you are trying to block access to something based on, say, the previous week's access log, and some intermediate process does some filtering, but that's a WAG right now.

Quote:
is there any other application like this one.
That does something like something that you won't tell us? Oh, I am sure that there is

Quote:
so thats i was asking if i run swapoff and swapon will it affect users
If you are not using the swap that you turn off at the time, it probably doesn't have an effect, either good or bad. If you are using the swap that you turn off, it is probably a bit like Russian Roulette; sometimes it will do nothing that you notice, and sometimes it will crash your system (maybe, not even immediately). If you do crash your system, there is no guarantee that it won't corrupt your system, so have good backups before you try this.

Quote:
once (my suggested correction) the application reaches 5.3 gb of physical RAM then the application makes use of the swap memory
i have 2 swap partition each of 6gb, so when 6 gb of one swap is utilised then the system hangs
This app sounds to be doing some pretty serious stuff, if it is still growing as it reaches 5.3 G of memory. Maybe its written pretty inefficiently...maybe it has a rather large data set, can't tell from here. (Particularly, if the app is doing something that could as easily be accomplished with, eg, grep, which might not be your first choice for such things, but doesn't tend to have its memory usage explode exponentially with increasing sized data sets).

@johnsfine
Quote:
What did you mean by "so" or maybe what did you mean by "6 gb of one swap is utilised"? When almost all of both swap partitions is utilized, the system would be likely to hang. Why are you focusing on one swap partition? Are they set to equal priority so they are used about equally? Or is one used preferentially?
I'm fascinated by this, too; I'm writing this from a laptop which has two swap partitions which it uses sequentially, so I can absolutely confirm that just because it has exhausted the first swap partition does not mean that the machine will crash. It just goes on to use the second.

OTOH, when it is that deep into swap, in normal operation, the machine has to do a lot to make pages available to do anything new, so it can slow down very dramatically and can seem to be as good as dead (apart from the almost continuous disk drive illumination).

So that 'so' from the OP does require some explanation.
 
Old 12-07-2010, 01:31 AM   #21
fernfrancis
Member
 
Registered: Feb 2009
Location: Goa(India)-Sharjah(UAE)
Distribution: RHEL,centos,fedora,ubuntu
Posts: 229

Original Poster
Rep: Reputation: 18
sorry guys

ok I have 6 GB of physical RAM and 12 GB swap which is divided into 6gb each.yes i use top
to check the system status i usually notice that there is 50mb of physical ram remaining and then the sytem makes use of the swap memory after 6GB of swap is utilizes then the system hangs.it doesnt utilize the entire 12GB swap

i wanted to use swapoff and swap on to free up the memory used, so i am not sure whether this will bring down the application in doing so. please advice what i can do as every 21 days i have to do a restart of the system. I have monitored this
let me know if there is a solution
 
Old 12-13-2010, 01:42 AM   #22
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
OK - FORGET your "swapon" and "swapoff".

Heck - DELETE your 2nd 6GB swap partition. It doesn't sound like you've ever used it, or it's doing you any good.

MAIN POINT:
Focus on why you're gradually consuming all available RAM, then consuming all available swap (at least in your first swap partition).

It sounds like you've got an application with a major memory leak.

Correct?

Your first priority should be to identify - and, hopefully fix - the application. Correct?

An interim workaround might be to reboot the system periodically (e.g. every week - perhaps even every night). Correct?
 
Old 12-13-2010, 03:52 AM   #23
fernfrancis
Member
 
Registered: Feb 2009
Location: Goa(India)-Sharjah(UAE)
Distribution: RHEL,centos,fedora,ubuntu
Posts: 229

Original Poster
Rep: Reputation: 18
yes paulsm4 your absolutely right

how do i solve this memory leak issue, i am not a c developer and we dont have any c developers with us
we cant stop that application also
is there a work around
 
Old 12-13-2010, 07:01 PM   #24
gd2shoe
Member
 
Registered: Jun 2004
Location: Northern CA
Distribution: Debian
Posts: 835

Rep: Reputation: 49
Quote:
the application is written in c , it was written by one developer in the organisation who is not longer available with us.
Quote:
how do i solve this memory leak issue, i am not a c developer and we dont have any c developers with us
we cant stop that application also
Magic?

Either hire a C programmer*, learn C yourself, or rewrite the app using a language your team knows. I'm not sure what else we can tell you.

*(There are firms specializing in minor tweaking of other people's code. No, I haven't dealt with any personally.)
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
process, memory, swap, virtual memory wakatana Linux - Hardware 1 08-31-2009 08:55 AM
swap memory rehan999 Linux - Software 5 04-09-2008 08:45 AM
Why is 1 GB of my memory Swap? ThaHabbis Linux - Hardware 10 03-18-2008 08:28 PM
Swap Memory / Virtual Memory in Fedora Core 6 Jojo_CFT Linux - Newbie 2 10-15-2007 05:23 AM
Difference between Swap Virtrual memory and Swap Parition Nappa Slackware 4 11-27-2003 08:58 PM


All times are GMT -5. The time now is 10:06 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration