PDA

View Full Version : temporary processes still made/killed too often with large volumes


fantasydreaming
06-19-2008, 06:10 PM
I was told long ago about the "Dynamic" half of the processes - the "max" you set is always there, and an additional number equal to that number are spawned as necessary.

But in my experience they're almost always spawned, they just only stay for about ~6 seconds. At least 2 "temporary" ones are spawned about 60% of the time, when I check at about 1 second intervals. My server load is at .4, and there's not any waiting in the queue when I check on the website - the 4 "base" processes should be enough to handle it really...

They never seem to live more than a few seconds, before they're killed and restarted again.

This is annoying because even though it's copying-on-writing the memory from the parent process, rails still does a bunch of junk unique each time once it's actually running and so the memory gets dirtied pretty quickily. If you're at all short on memory this means thrashing and really low performance.

I'd thought it was more fixed in the past, but perhaps not. Perhaps the most recent version added problems back again too though, it's hard to tell...

mistwang
06-19-2008, 09:27 PM
Have you tried "LSAPI_MAX_IDLE_CHILDREN"?
You can post your rails configuration.
Maybe we need to check your server if possible.

fantasydreaming
06-19-2008, 10:43 PM
I've tried increasing my # of children to Max Connections=5

checking my process list, there are only 4-5 showing, and 1-2 of them has always only been around 1 minute. Doing an s-trace as quick as I could showed:

# p 25382
Process 25382 attached - interrupt to quit
select(4, [3], NULL, NULL, {0, 625000}) = 0 (Timeout)
getppid() = 27034
select(4, [3], NULL, NULL, {1, 0}) = 0 (Timeout)
getppid() = 27034
select(4, [3], NULL, NULL, {1, 0}) = 0 (Timeout)
getppid() = 27034
select(4, [3], NULL, NULL, {1, 0}) = 0 (Timeout)
getppid() = 27034
select(4, [3], NULL, NULL, {1, 0}) = 0 (Timeout)
getppid() = 27034
rt_sigaction(SIGINT, {SIG_DFL}, {0x80d08a0, [INT], SA_RESTART}, 8) = 0
close(7) = 0
munmap(0xb6e69000, 4096) = 0
close(7) = -1 EBADF (Bad file descriptor)
munmap(0xb6e6a000, 4096) = 0
close(6) = 0
munmap(0xb6e6b000, 4096) = 0
close(6) = -1 EBADF (Bad file descriptor)
munmap(0xb7706000, 4096) = 0
close(5) = 0
munmap(0xb7707000, 4096) = 0
poll([{fd=4, events=POLLIN|POLLPRI}], 1, 0) = 0
write(4, "\1\0\0\0\1", 5) = 5
shutdown(4, 2 /* send and receive */) = 0
close(4) = 0
exit_group(0) = ?
Process 25382 detached


another showed:

getppid() = 27034
select(4, [3], NULL, NULL, {1, 0}) = 0 (Timeout)
getppid() = 27034
select(4, [3], NULL, NULL, {1, 0}) = 0 (Timeout)
getppid() = 27034
select(4, [3], NULL, NULL, {1, 0}) = 0 (Timeout)
getppid() = 27034
rt_sigaction(SIGINT, {SIG_DFL}, {0x80d08a0, [INT], SA_RESTART}, 8) = 0
close(7) = 0
munmap(0xb6e69000, 4096) = 0
close(7) = -1 EBADF (Bad file descriptor)
munmap(0xb6e6a000, 4096) = 0
close(6) = 0
munmap(0xb6e6b000, 4096) = 0
close(6) = -1 EBADF (Bad file descriptor)
munmap(0xb7706000, 4096) = 0
close(5) = 0
munmap(0xb7707000, 4096) = 0
poll([{fd=4, events=POLLIN|POLLPRI}], 1, 0) = 0
write(4, "\1\0\0\0\1", 5) = 5
shutdown(4, 2 /* send and receive */) = 0
close(4) = 0
exit_group(0) = ?
Process 25753 detached

What should I try setting LSAPI_MAX_IDLE_CHILDREN to? It's not that too many children are being created, it's that they're being created and destroyed so often.

My current ruby settings:
Ruby Path
/usr/local/bin/ruby
Rails Environment
Production
Max Connections
5
Environment
LSAPI_MAX_REQS=9000
LSAPI_MAX_IDLE=550
Initial Request Timeout (secs)
160
Retry Timeout (secs)
0
Connection Keepalive Timeout
600
Response Buffering
Yes
Back Log
50
Run On Start Up
Yes
Max Idle Time
550
Priority 3
Memory Soft Limit (bytes)
220M
Memory Hard Limit (bytes)
270M
Process Soft Limit
120
Process Hard Limit
160

Thanks for a great product!

mistwang
06-19-2008, 11:02 PM
try
LSAPI_MAX_IDLE_CHILDREN=5