Questions tagged [preforking]

Use this tag for questions related to Preforking (servers).

Pre-forking basically means a master creates forks which handle each request. A fork is a completely separate *nix process.

as stated in What exactly is a pre-fork web server model?

26 questions
159
votes
2 answers

What exactly is a pre-fork web server model?

I want to know what exactly it means when a web server describes itself as a pre-fork web server. I have a few examples such as unicorn for ruby and gunicorn for python. More specifically, these are the questions: What problem does this model…
Hery
  • 7,443
  • 9
  • 36
  • 41
16
votes
1 answer

accept() with sockets shared between multiple processes (based on Apache preforking)

I'm working on some Python code modeled on Apache's MPM prefork server. I am more an applications programmer than a network programmer and it's been 10 years since I read Stevens, so I'm trying to get up to speed in understanding the code. I found a…
Andrew Dalke
  • 14,889
  • 4
  • 39
  • 54
12
votes
2 answers

Ruby readpartial and read_nonblock not throwing EOFError

I'm trying to understand and recreate a simple preforking server along the lines of unicorn where the server on start forks 4 processes which all wait (to accept) on the controlling socket. The controlling socket @control_socket binds to 9799 and…
Sid
  • 6,134
  • 9
  • 34
  • 57
9
votes
1 answer

PHP readfile() never ends and makes Apache server hang

I have a big problem with an apache server, php app. The server is serving a quite high traffic website which is running with php. Every 24h or 48h, apache hangs, and i have to reboot it to be able to access the website again. I have to reboot it,…
hedi
  • 1,476
  • 2
  • 11
  • 14
3
votes
1 answer

FastCGI fork in c

I'm currently developing highload project, i need to use C/FastCGI/nginx combination. The problem is, i need my FastCGI application to run in threads/processes. I know two ways to do that: 1) Compile program and than use spawn-fcgi to fork…
artyomboyko
  • 2,781
  • 5
  • 40
  • 54
3
votes
1 answer

Prefork MPM configuration not in httpd.conf

I have a memory problem with my EC2 Micro instance which is causing it to terminate my MySQL process. I've read a lot about tuning Apache to limit the memory consumption and am looking to edit the Prefork MPM settings. Catch is - when I go into…
Hassan
  • 31
  • 3
2
votes
0 answers

apache/php module socket issue

I'm running an Apache2.2 server+PHP 5.2 under Debian Lenny 32bit. I've built in C a "simple" php module extension. This extension is doing one thing: Calling, through a socket, a small "echo server" and waiting for the result (sending/receiving a…
Stef
  • 3,691
  • 6
  • 43
  • 58
2
votes
2 answers

FastCGI / SCGI pre-fork

I've been trying to implement a web server gateway (for fun and educational purposes) and I have some questions about the core architecture behind FastCGI/SCGI with respect to the pre-fork model. How do FastCGI/SCGI implementations handle…
André Caron
  • 44,541
  • 12
  • 67
  • 125
2
votes
2 answers

Do I need gunicorn for internal async microservices?

As far as I read all over the Internet - the best practice for deploying Flask/Django applications is to put the behind a web server such as nginx and bundle them with a pre-fork server such as gunicorn or uWSGI. This is good for many reasons, such…
akiva
  • 2,677
  • 3
  • 31
  • 40
2
votes
1 answer

Preforking a Multithreaded Python application

I have a Python program that is already multithreaded and I'd like to replace some of the threads with processes in order to reduce context switching and utilize gevent for async I/O. The main process is I/O bound so I'd like to use gevent in order…
the_drow
  • 18,571
  • 25
  • 126
  • 193
2
votes
1 answer

Is it necessary to use a lock for the accept function when doing socket programming?

I have created a preforking web server which creates the server socket, binds it, listens to an address and port and it preforks a specified number of workers (child processes) which act as workers serving client requests. All workers inherit the…
1
vote
1 answer

`os.register_at_fork` `after_in_child` not called

I'm trying to add a postfork function to patch my program after my Django application is forked by Gunicorn/uWSGI to spawn workers. Now the problem is I know I can do this by adding @postfork decorator, but I thought it could be also achieved by…
HelloWorld
  • 290
  • 3
  • 14
1
vote
1 answer

Use a socket accepted by the parent process, in a child process created before accepting the socket

I am writing a crossplatform, multiprocess and multithreaded server using the "pre forking model" and the C language. Depending on the mode (multiprocess or multithread), the server just started, creates a set of processes/threads whose task is to…
user5442271
1
vote
0 answers

Celery scheduled tasks created inside other tasks do not go to broker immediately

I have my celery tasks setup like following: @celeryapp.task def heavy_task(x, y): # some stuff for _ in range(10000): heavy_task_2.apply_async(args=(x,y), countdown=random.randint(60,120)) return…
1
vote
1 answer

How to serve PHP dynamic images efficiently on a LAMP server?

Right now I'm running a PHP script on my LAMP (CentOS/Apache/MySQL/PHP) stack that generates dynamic images using GD. I'm caching them on the hard drive for 5 minutes. If a cached version exists, I pull that instead of generating a new one. This…
Chris
  • 65
  • 1
  • 4
1
2