-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Thoughts on a plugin architecture #96
Comments
Have you seen: #92 I'm not convinced a plugin system is needed for that, but also perhaps I don't quite understand what you have in mind? Also the soft timeout is a bit inadequate right now, I need to make some changes to it. |
Yes we're aware of Maybe you can add like a Does that make sense? EDIT: Meant to say |
I don't understand why you'd want to do that. But if you really want to do that, you don't need anything special from Pitchfork, you can just spawn that thread from |
Sorry @casperisfine not sure how request_env = process_client(client, worker, prepare_timeout(worker))
@after_request_complete&.call(self, worker, request_env)
worker.increment_requests_count What we need is a callback before process_client is called that allows us to begin the memory thread monitor, just as you're doing with timeout via Maybe something simple like @before_request&.call(self, worker)
request_env = process_client(client, worker, prepare_timeout(worker))
@after_request_complete&.call(self, worker, request_env)
worker.increment_requests_count Will you accept a PR for this? |
My point is you don't need to start that memory monitor thread on each request. Actually it would be really bad for performance. You can just do something like: after_worker_fork do
loop do
if memory_exhausted?
exit! 42
end
sleep 1
end
end But again, I don't see why you wouldn't just do that on |
We're exploring a way to limit memory usage of individual workers, kinda similar to how you've implemented timeouts. Where a timeout allocates a fixed number of seconds a request is allowed to run before being killed, we wanted to implement the same for memory usage.
I wonder if there's any interest in implementing a lightweight plugin system, that the timeout implementation can be refactored to use, and then other features like our "memory limiter" could be developed on the same set of rails without us having to fork or monkey patch the code base.
The text was updated successfully, but these errors were encountered: