Skip to content
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

In http-server, give priority to read requests #2

Open
ghost opened this issue Mar 27, 2014 · 2 comments
Open

In http-server, give priority to read requests #2

ghost opened this issue Mar 27, 2014 · 2 comments

Comments

@ghost
Copy link

ghost commented Mar 27, 2014

In mostly-read servers, in order to allow the server to keep answer to its clients, it would be helpful to give the read requests (e.g. GET or HEAD) some priority over the update requests (e.g. PUT, POST, DELETE).

Suggestion for implementation: in the availability filter, add threshold for the update requests, so if the number of available thread exceeds this threshold, the server will reject the update requests with SERVER IS BUSY HTTP status (503), as currently done when there are no available thread at all. For read requests, the server will keep the current behavior.

Other solution may be to somehow split the update requests and the read requests to two different thread pool.

@duvy
Copy link

duvy commented Apr 20, 2014

I agree that this is useful functionality. I recommend looking at using Jetty's QoS filter. If added before the AvailabilityFilter, I think it can provide the desired priorities based on URL patterns. If you want to group requests specifically based on HTTP method instead, it seems easy to subclass the filter and override the getPriority method. Have a look here for more details:
http://www.eclipse.org/jetty/documentation/current/qos-filter.html

The problem is that I don't think we can currently add our own filters before the built-in filters. In general, the ability to insert filters at various points should be considered for a future release. Perhaps we should start a new thread on this.

Alternatively, I suggest considering having foundation include Jetty's QoS, possibly wrapping it to simplify setting up priority based on HTTP method as requested by nahsh.

@yairogen
Copy link
Contributor

Would you be able to request a new feature of enabling custom filters additions and based on that test out the QOS Filter?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants