Is it possible to implement somehow request size restriction on haproxy side? As I understand how haproxy works it passes data from frontend socket to backend. If it works on HTTP level it might detect amount of data transferred during the session. And if this amount reach some limit, e.g. 20 MB it abororts the session. Is it possible to configure somehow such logic? Maby lua can help? But I do not want to collect all 20 MB to haproxy memory, ofcourse.
Related
I'm been building a NodeJS application with a team. A team member limited the server request size to 8Kb - if it's bigger than that, the request will be rejected on the server. The idea is that we don't want to process requests that are too big to avoid a potential DoS.
This brings up the issue that what if we wanted to make generally big requests (batch a couple of small requests together, since according to this, it's better than sending a bunch of small requests). And example would be for a TODO list, if I edit 100 TODOs at the same time (I send the UUIDs of each of the todo items back to the server along with the updates); this request could exceed 8Kb in size. I couldn't find if there are standards for max HTTP request sizes.
What would be the solution for wanting to send back larger HTTP requests from the client to the server? Should I:
Increase the HTTP request size on the server? What's the standard? I could 100x it and that would solve much of the problem
Limit the request size on the client. For example, limit it so the user could only edit 100 TODOs at max! Anymore, and the request won't send.
A combination of 1 and 2?
Thank you!
I have a website that is frequently overloaded with multiple requests from thousands of clients. I cannot scale to infinity my servers and the application in current state is not possible to handle the traffic. For a better comfort I would like to let firstly the clients that started the transaction to complete it, and after that allow other clients to start the transaction. I am looking for a solution how to divide HTTP requests to two groups: the first requests that are able to finish the transaction and the others that should receive the 503 Server busy web page.
I can handle some amount of transactions concurrently. The rest transactions I would like to hold for a while with Server busy web page. I thought that I can use varnish for that. Bud I cannot think up the right condition in VCL for that.
I would like to find in varnish the number of current connections to the backend. If the current number of connections will be higher than some value (eg. 100) and the request didn't have a session cookie, the response will be 503 Server busy. If the number of connections will even greater than 100, but the session cookie exists, the requests will be passed to the backend.
AFAIK in varnish VCL I can get only the health of the backend (director) that should be true/false. But when backend is considered not healthy, the requests are not passed to it. When I use max_connections to the backend, all connections up to the limit will got 503 error.
Is there a way how to achive this behavior with varnish, ngingx, apache or any other tool?
Does your content have to be dynamic no matter what? I run a site that handles 3 to 4 million unique a day and use features like grace mode to handle invalidation.
Maybe another option is ESI, Edge Side Includes, that may help reduce load by caching everything that isn't dynamic.
I have several clients that constantly post data to a REST service. REST service is put behind a network load balancer. Each client sends 100 - 500 MB a day and I need to support 500+ clients.
I can POST either very large packets, this will reduce overhead for TCP/IP session set up and HTTP headers. This will, however, firmly tie one client to a particular server and limit my scalability options. Alternatively, I can send small HTTP packets, which I can load balance well, but I will get more overhead for TCP/IP session set up and HTTP headers.
What is the recommended packet size for HTTP POST? Or how can I calculate one for my environment?
There is no recommended size.
While HTTP POST size is not constrained by the RFCs, since HTTP is a commodity protocol implementing request / response type messaging, most of the infrastructure is configured around the idea that TCP connections are not particularly long lasting / does not carry significant amounts of data. i.e. there will be factors outside your control which may impact the service - although HTTP supports range requests for responses, there is no corollary for requests.
You can get around a lot of these (although not all) by using HTTPS. However you still need to think about how you detect/manage outages - are you happy to wait for a TCP timeout?
With 500+ clients presumably using the system quite heavily, the congestion avoidance limits shouldn't be a problem - whether TCP window scaling is likely to be an issue depends on how the system is used. HTTP handshakes should not be an issue unless you restrict the request size to something silly.
If the service is highly dependant on clients pushing lots of data on to your server, then I'd encourage you to look at parsing the data on the client (given the volume, presumably it's coming from files - implying a signed java applet or javascript with UniversalBrowserRead privilege) then sending it over a bi-directional communication channel (e.g. websocket).
Leaving that aside for now, the only way you can find out what the route between your clients and your server will support is to measure it - and monitor it. I would expect that a 2Mb upload size would work pretty much anywhere, while a 10Mb size would work most of the time within the US or Europe - and that you could probably increase this to 50Mb as long as there's no mobile clients.
But if you want to maintain the effectiveness of the service you'll need to monitor bandwidth, packet loss and lost connections.
We want to reduce the https connect latency to facebook graph servers. We have configured our servers to do a http keep alive. However, it looks like the connection gets closed after every call (from traffic server logs...).
Is there a way to deterministically see that keep_alive connections are honored or not by graph.facebook.com? ..or for that matter any server in general?
Based on Facebook's attitude towards efficient queries, I would not expect them to honor any type of persistent connection. Especially since your request is going to end up in a performance hit on their servers.
You should look at fetching as much data as you can in one go by combining your queries into a single batch request.
I was wondering how can I find the "number of connections limit" for a web server.
Most of the cases I encountered it is limited to 6 connections (Meaning I can have 6 connections to this webserver working at the same time).
Is there any request I can send over HTTP?
Could you be more precise ? What kind of server ? Any ? For which OS ?
If it's an Apache http server, you should have a look in the settings file (should be /etc/httpd/conf/httpd.conf under Linux). Search for MaxClients option.
For example, I use a small apache server at home which can process 300 simultaneous requests (connections).
EDIT :
I think you won't be able to get the server specifications. You should try to overload it in order to guess its limits.
There's nothing like this in the HTTP standard, it aims to isolate HTTP requests from each other as much as possible. There might be a server-specific way to query this.
Depending on the architecture of your server, there could be a far greater number of TCP connections accepted than worker threads generating the HTTP responses, so you need to ask yourself what exactly you are interested in, and then just measure it with jmeter.