Load tests are failing due to System.Net.Sockets.SocketException

Piyush Meshram 1 Reputation point
2021-09-21T12:10:49.043+00:00

I need some help with this error:

System.Net.Sockets.SocketException 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 example.com:80

I have hosted a website in IIS on port 80 only.

5 other sub web services are hosted and all are using the same port 80 and same app pool.

I need to understand few things as follows:

  1. As I have several web application (a website and 5 Web Services) running, will it cause socket connection errors? if so how can I keep track of the limit of the available sockets IIS/System can handle.
  2. Web applications will be hosted on IIS 64bit of windows server 2019 8Gib RAM, Azure D2 V2 VM. Is it a good idea?
  3. I don't want the system to have socket exceptions because of too many concurrent connections. How to solve this problem? may be with each app in separate app pool or something?
  4. Test Case Scenario: Website will have max 5 users only but web services will be used by 30 users and each user can fire up to 90,000 requests in a day (sometimes up to 20 concurrent request each user might fire) for a single web API. I need a way to monitor/know how many concurrent requests are possible?
  5. Each web service call will take less than 2 seconds to complete and code is pretty good and it runs smoothly for 1000 concurrent threads no problem. I am using SOAP UI to load test the application from a PC with normal specs (dual core, 8gb ram) and if I increase the load the socket connection failures as mentioned above occurs. Where is the problem code, IIS Server level or client side?
  6. I think the above few points will help to understand the environment these applications are running in. I would like to know some best practices to follow in such cases.
Internet Information Services
Azure Virtual Network
Azure Virtual Network
An Azure networking service that is used to provision private networks and optionally to connect to on-premises datacenters.
2,135 questions
Windows Server
Windows Server
A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.
12,105 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. MotoX80 31,571 Reputation points
    2021-09-24T14:48:36.483+00:00

    Use the IIS request monitor to see active requests.

    https://inthetechpit.com/2019/11/10/check-incoming-requests-iis-with-request-monitor/

    Check the HTTP error logs for anything "bad". C:\Windows\System32\LogFiles\HTTPERR

    Run the netstat command from an admin command prompt to see how many sockets are open.

    netstat -aon
    

    Use LogParser to analyze your web sites log file. Look for long response times.

    https://www.microsoft.com/en-us/download/details.aspx?id=24659

    logparser "SELECT  TO_LOCALTIME(TO_TIMESTAMP(date,time)) as [Local Time], c-ip, cs-username, sc-status, cs-uri-stem, cs-uri-query,  time-taken FROM c:\inetpub\logs\logfiles\w3svc1\u_ex*.log order by [Local Time] " -rtp:-1 -recurse 
    
    1 person found this answer helpful.

  2. MotoX80 31,571 Reputation points
    2021-09-29T23:54:49.637+00:00

    Decades ago we were testing a new system and the company paid users overtime to come in on a weekend to test it. They all hit enter at the same time and the system crashed.

    Then they asked me to try to simulate the users with some software that they purchased. So we tried to think through how a real user would access the system. They might come in to the office sign in, do a few things, and go get a cup of coffee or maybe go to the bathroom. Then come back to their desk and work at a somewhat randomized pace depending on when a customer might call for information, or the user might get interrupted with a phone call or something.

    We had a number of discussions on "how many concurrent order entry users", "how many concurrent order inquiry users", "how many users accessing other parts of the application", "how may users logged in but doing nothing at any given time", etc. Plus our user base was US centric but spread out from east to west coast. So when west coast users were signing in, east coast users might be going to lunch.

    So for whatever load test tool you are using, your "script" should include "think time" and spread out the user logon timeframe over whatever period you expect your users to sign in. Don't just throw thousands of users at your site, you need to consider how an actual human might use the site.

    Based on the numbers that you have given, I would suggest starting small, lets say 500 users, and let it run for a while and try to reach some normalization point where you can determine that "this many users" need "this much cpu and memory". Watch the cpu/memory/disk utilization on both the web and database servers.

    Then ramp up, go to 750 users. But each time you increment, you need to have your web and database admins look at the performance. What requests are taking the longest time? How efficient is the SQL call? Is the disk subsystem able to keep up with the I/O? How is memory utilization, CPU utilization, where is the bottleneck?

    Did you use the '-aon' switches when you ran netstat?

    0 comments No comments