• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 274
  • Last Modified:

samba load/queue query - unix

I have a application that sends out jobs to around 100 machines, and those jobs running on each machine will request files from the server.  The files are anything from bytes to Gb.  When too many machines request data, the server hits the limit of what it can output and the jobs end up running slowly as they are waiting on data and this is causing problems.

So I need to measure the load on my samba server so can I stop handing out jobs when the server is at the limit of what it can handle.

I need unix command that returns a single number that represents the load of the server _above_ the limit of what it can handle - i.e. the number of requests in the queue.  I want the server to run at capacity, but not queue up too many requests.  The throttle must be done by my serving app as denying clients files is not an option.  If this number is high, no jobs will be handed out.

Server is running Fedora Core 4

Thanks.

0
peeldog
Asked:
peeldog
  • 2
1 Solution
 
ravenplCommented:
is pasing output from 'smbstatus' command applicable?
0
 
peeldogAuthor Commented:
Anything that will run on my Fedora core samba server is fine.  Shell and perl scripts are fine too.  Even a small c app that I can compile would do.  Really I just need a way to measure the load above the limit, and if it is high, I will not hand out any more jobs.

I don't know that smbstatus will give the information I need though.  The jobs that are running could have lots of files open for the duration they are running, but I need to know if they are sitting idle waiting on data from the server.
0
 
ezatonCommented:
I think that the thing you are looking for is the i/o wait value. The higher it is (I would presume that around 30% is rather high, but it can be measured) the slower the response of the server would be. You can obtain it by using 'top', or by using 'iostat -kt 5 -x', for example. However, extracting the value you require out of the output I leave to you.
0
 
peeldogAuthor Commented:
I graphed the i/o wait value last night and it doesn't seem to be too bad.  I also graphed the total Send-Q output from netstat and it was pretty bad.  I'm throttling based on that and it seems to be helping lots.  Is there a way to get statistics based on the Send-Q?  If I run netstat it returns what it is at any given moment.

Also is there a way to get the sendq based on an indvidual ip?

This is what I have hacked together for now with php, which seems to be working...

function netstat()
{

        $st = `netstat -t -n`;

        $lines = split("\n", $st);

        $total = 0;
        for($i=0; $i<sizeof($lines); $i++)
        {
                $sp= preg_split("/\s+/", $lines[$i]);
                if(sizeof($sp)>2 && is_numeric($sp[2]))
                        $total+= $sp[2];
        }
        return $total;
}


function netstat2()
{

        error_reporting(E_ALL ^ E_NOTICE);
        $st = `netstat -t -n`;

        $lines = split("\n", $st);

        $iplist = array();
        $idlist = array();

        $total = 0;
        for($i=0; $i<sizeof($lines); $i++)
        {
                $sp= preg_split("/\s+/", $lines[$i]);
                if(sizeof($sp)>2 && is_numeric($sp[2]) && $sp[2] > 0)
                {
                        $value = $sp[2];
                        $ips = split(":", $sp[4]);
                        if(sizeof($ips)>1)
                        {
                                $ip = $ips[0];
                                $iplist[$ip]+=$value;
                        }
                        $total+= $sp[2];
                }
        }
}

Does that look right maybe?

I can use the ip address of the destination to see what jobs are causing the traffic and throttle them only, which seems to work great as it will let small jobs that don't need many files through and limit large jobs from hammering the server.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now