Semaphore - what is that?

  • Gandalf
  • Beginner
  • Beginner
  • User avatar
  • Posts: 48

Post 3+ Months Ago

My VPS is limited to 128 semaphores, which usually get finished within 3 days. I had to delete them and restart apache in order to enter sites hosting on this VPS.

this post explains much of what i face as well http://beau.org/pipermail/whitebox-user ... 02269.html

My question is what is Semaphore? What casues it to end up within 3 days and how i can improve performance of my VPS?

Thank you in advance.

Here is statistics that i get when via SSH i make a command
ipcs -u

-------Semaphore Status --------
used arrays = 93
allocated semaphores = 93
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • Daemonguy
  • Moderator
  • Web Master
  • User avatar
  • Posts: 2700
  • Loc: Somewhere outside the box in Sarasota, FL.

Post 3+ Months Ago

Oh lord.

This is a tough one. A semaphore is a lot like a locking mechanism, only smarter. You know, file locks, only one person may edit at a time? Well, in a VPS you have an order of precedence in which tasks must be accomplished. One precedes another which succeeds another, etc. ad nauseam.
The semaphore is used to maintain that precedence order; more to the point, the precedence order is maintained by the semaphores.
A succeeding task may not start until it has received the semaphores from all of it's predecessors; this is the order of communication in which a semaphore is used to 'talk' to all successors.
That is with respect to VPS. Semaphores are actually widely used in programming to share resources cleanly; BSD uses it for interprocess communication -- one of the reasons I dig BSD so much. ;)


Does that make any sense?

As for fixing... well that is a bit tougher. Do you have an application called ipcs? It comes default on BSD systems as well as several distributions of Linux to monitor things like semaphores.
Unfortunately, the ipcs that comes with linux is rather limiting; lots more flags in BSD.
As for raising the limit... I suppose you could hack the kernel code to raise the limit, or shut down other apps running with semaphores that are not required?

//edit: Oh my, this is going to be a long day. I just noticed you typed the ipcs command in your original messages. Oi. So give me an ipcs -l .

I am really not sure what else to tell you. Is this one system running Apache with a ton of connections? Or a cluster? Do you maintain the box(es) yourself, or is this managed hosting?
  • Gandalf
  • Beginner
  • Beginner
  • User avatar
  • Posts: 48

Post 3+ Months Ago

Quote:
Does that make any sense?


this makes some :)

let me explain and reply to some of your questions. I hope this will clarify some.

This is one dedicated server with several Virtual Private Server. So it is not really a dedicated server and it is not really a sharing one. For each vps we have own apache.

Regarding maintainment, it is both, we can manage it as we have root access and we can ask hosting to do things for us like recompile apache, etc. Although this support is limited.

How i solve the problem now?
- I delete semaphores and restart apache when their number.

Regarding your methods - i am not sure we can hack the kernel code to raise the limit, however 'shut down other apps running with semaphores that are not required', sounds like an option - what could be such apps that require semaphores.

If you need more info let me know. I really do not feel good about having to SSH my server each three or four days, delete semaphores and restart apache ;)

My suspection is that this is Apache problem, so i have one reserved optional solution is ask hosting to recomile apache. However, i am not sure this will help much.

I also have a question, can mod_rewrite .htaccess rules cause this problem somehow?
  • Daemonguy
  • Moderator
  • Web Master
  • User avatar
  • Posts: 2700
  • Loc: Somewhere outside the box in Sarasota, FL.

Post 3+ Months Ago

Gandalf wrote:

This is one dedicated server with several Virtual Private Server. So it is not really a dedicated server and it is not really a sharing one. For each vps we have own apache.


I was aware of those particular specifics. :)

Gandalf wrote:

Regarding maintainment, it is both, we can manage it as we have root access and we can ask hosting to do things for us like recompile apache, etc. Although this support is limited.

How i solve the problem now?
- I delete semaphores and restart apache when their number.

Regarding your methods - i am not sure we can hack the kernel code to raise the limit, however 'shut down other apps running with semaphores that are not required', sounds like an option - what could be such apps that require semaphores.

If you need more info let me know. I really do not feel good about having to SSH my server each three or four days, delete semaphores and restart apache ;)

My suspection is that this is Apache problem, so i have one reserved optional solution is ask hosting to recomile apache. However, i am not sure this will help much.

I also have a question, can mod_rewrite .htaccess rules cause this problem somehow?


No, if you don't own the box, you can't hack the kernel. The problem is I just don't know enough about your setup to make a valid diagnosis; I fell like I am shooting randomly.

OK. Let's start with this.
What version of Apache? What OS at what level and what kernel? Run an ipcs and post the results.

Do you have AcceptMutex <something> in your httpd.conf? If so, what is it? Do these boxes run anything else? Middleware?

Anything else you can think of that might be helpful, would be good to post.

Cheers.

Post Information

  • Total Posts in this topic: 4 posts
  • Users browsing this forum: No registered users and 23 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.