very fast PUT requests result in ECONNRESET - request

I am trying to create a server to receive PUT requests from remote clients (sensors)… all this is baby-steps for me. I have a simple hapijs server listening on port 3000 and inserting data into a PouchDB database. When I send a few (5 or so) PUT requests using the nodejs request package, the records are entered fine. But if I want to test with a large amount (500 PUT requests), I get
○ → node bin/new_records.js --num 500
events.js:160
throw er; // Unhandled 'error' event
^
Error: connect ECONNRESET 127.0.0.1:3000
at Object.exports._errnoException (util.js:1036:11)
at exports._exceptionWithHostPort (util.js:1059:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1080:14)
How do I get past this? Ideally the server should be able to handle as many PUT requests as fast as possible (even though in real life the situation may be a lot more tranquil).

Related

Apache2: how to log rejected connections and client timeout

I am doing some load testing on a service run with Apache2 and my load testing tool has a default timeout of 30 seconds. When I run the tool for a minute with 1 request per second load, it reports that 40 succeeded with 200 OK response and 20 requests were cancelled because client timeout exceeded while awaiting headers.
Now, I was trying to spot this on the server side. I can't see the timeouts logged either in apache access logs or gunicorn access logs. Note that I am interested in connections that weren't accepted as well as that are accepted and times out.
I have some experience working on similar services on Windows. The http.sys error logs would show connection dropped errors and we would know if our server was dropping connections.
When a client times out, all the server knows is that the client has aborted the connection. In mod_log's config, the %X format specifier is used to log the status of the client connection after the request has completed, which is exactly what you want to know in this case.
Configure your logs to use %X, and look for the X character in the log lines.
Bonus: I even found the discussion about this feature in apache's dev forum, from 20 years ago
Update:
Regarding refused connections, these cannot be logged by apache. Connection refusal is done by the kernel, in the tcp stack, and not by apache. The closest solution including only apache that I can think of is keeping track of the amount of open connections (using mod_status). If it reaches the maximum you know you might be refusing connections. Otherwise, you'd need to set up some monitoring solution to track tcp resets sent by the kernel.

Implement Send Mail Task with multiple tries in case if its failed to send mail

I have implemented a Send Mail Task in my package which sends a mail notification on Success or Failure. The send mail task fails sometimes due to the below error.
Task failed: Send Mail Task with Success
Error Code: -1073548540
ErrorMessage: An error occurred with the following error message: "Failure sending mail.
System.IO.IOException: Unable to read data from the transport connection:
An existing connection was forcibly closed by the remote host.
System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host"
I have reported the issue to network admin but they suggested the following.
The errors you are receiving from Mailhub can happen occasionally when trying to open a connection.
The only way to resolve this issue is to force multiple retries. If you can, please try to code in ~3-4 retries in your app.
I am sure that it can be done through a script task. I am not sure whether I can implement the multiple tries in case of failure using send mail task.
I have already implemented 20 plus packages with send mail task. I try to implement this approach with minimal change.
I tried the with SQL Server Agent job step configuration, the user has the option of configuring the Retry attempts and the Retry intervals but it runs the whole package on failure which is not suitable for my scenario.
I have to run only send mail task alone in case if it failed to send email with multiple tries.
You mentioned C# option:
here is the logic you are looking for:
int retryCount = 0;
retry:
try
{
[Build and send your email]
}
catch
{
retryCount++;
if(retryCount<4) goto retry; //will try 4 times no matter what caused it to fall in to the catch
}
To not modify your project much.
Create a new package with a for container where you control the number of repetitions.
Create a variable of type int.
Add a package execution task.
In case of correct execution, assign a value to the variable that breaks the for loop.
In case of error you can register it in database or whatever you want.
The image below is for ssis-2008 but it is the same for ssis-2012

Getting 408 API request has timed out while accessing Watson discovery

For the past few days i have been trying to access my discovery profile but it is showing -- 408 API request has timed out, I don't understand what it is i tried on different browsers and different systems.
A 408 HTTP response code is admittedly confusing in this case as 400-level errors typically indicate the client (browser) took too long to send the necessary information so the server timed out the connection when a preconfigured duration has been exceeded.
In this particular case, however, a 502 Gateway Timeout HTTP response would be more appropriate. There are multiple complex interactions happening with some of the pages in Watson Discovery Tooling and sometimes the service experiences slowness. In general, I would investigate the status page for the affected IBM Cloud services to determine whether or not there are any customer impacting events.
To check the status of Watson Discovery and any IBM provided service, I would check https://console.bluemix.net/status to see if any of the slowness or errors line up with your experiences.

Deeper server block request

Today I had a problem searching songs on Deezer API. The server was blocking my requests.
A connection attempt failed because the connected party did not
properly respond after a period of time, or established connection
failed because connected host has failed to respond 195.244.30.137:80
What do I need to do so that it wouldn't happen again?
I solved my problem.
There was a internet problem in my side.
Sorry

getting "reached maximum number of connections" error with large volume of http requests on google app engine

I'm attempting to do some stress testing on my GAE application
to see how it's performance holds up with a large number of
simultaneous users. I tried having a 100 threads each send an https
requests within 1 second, but half of them failed with a 503 status code the following
message:
"Error: Connection not allowed: reached maximum number of
connections."
This is a paid app, so I tried upgrading the instance class and
setting up some idle instances, but it doesn't seem to make any
difference.
Is there a limit on the number of simultaneous connections? Or is
this because all the requests are generated from the same host?
Thanks
EDIT: Response to Kyle: I'm using jmeter and sending 100 simultaneous requests to google.com doesn't ahve any issues.
Response to Nick: I'm not expecting individual clients to send lots of simultaneous requests, I was trying to simulate 100 users sending 1 request each.
Unbeknownst to me, a colleague had added a custom throttling filter to our application :) I removed this from the web.xml and it solves the problem.

Resources