Strategies for managing a large volume of pending requests

I am looking to create a website that can notify users about events happening on the server. Here is my proposed plan:

  1. Send an asynchronous request to the server (ASP.NET) with a 600-second time-out
  2. If an event occurs on the server within those 600 seconds, the server will respond with event details
  3. If no event occurs within the time frame, the server will send a 'no event' response after 600 seconds
  4. JavaScript will process the server's feedback and send the next request accordingly

However, a potential issue with this approach is that a large number of visitors may lead to a high volume of 'pending' requests on the website.

Questions:

Is this pending request issue a problem? What solutions could address this challenge? Should I consider implementing a different approach?

Your advice and feedback are greatly appreciated.

Answer №1

My knowledge about how asp.net handles pending requests is limited, but it seems like what you're explaining is similar to long-polling. There are several challenges associated with this approach, including:

  • Each pending request uses a thread, requiring state to be stored on each thread.
  • If there are a significant number of connections, they may need to span multiple machines, necessitating an architecture to distribute endpoints and ensure incoming requests are directed to the correct machine. However, if you're broadcasting the same data to all users, this is simpler.
  • Proxies, ISPs, or other factors could potentially terminate your long-poll request, so you need a resilient architecture.

If you're interested in learning more about long-polling in asp.net, you can check out this question on Stack Overflow: How to do long-polling AJAX requests in ASP.NET MVC? This could be a good starting point.

Alternatively, you might want to consider using a third-party service like pusher to manage these connections for you, or explore options like App Engine's Channel API (disclaimer: I work on App Engine).

Answer №2

Perhaps consider sending more frequent requests to the server without using up too many server resources over a period of 10 minutes?

For example, you could send an AJAX request every 60 seconds to check for any events and notify the user if something has occurred. The downside is that there may be a delay of up to a minute before the user is notified of an event, so immediate notifications may be a challenge.

If immediate notifications are necessary, exploring the option of "long polling" with technologies like node.js could be a viable solution, although it may require some effort to implement.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

I keep trying to retrieve a specific property from an object, but every time I do, it returns as undefined

I'm currently employing Javascript within a React component. My goal is to retrieve a specific property from an object. If I log this object out to the console as shown below: console.log("Engine: ", this.Engine); The output looks like th ...

Optimizing ASP.NET: Effective method for preserving label.text data during postback utilizing PageMethods

AngularJS, $http service. Hello, I am currently utilizing AngularJS with the $http service to dynamically update the content of a text box when a user selects an option from a dropdown menu on my web page. It has come to my attention that the text in te ...

Utilize a function in module.exports that calls for a variable within the module

I am currently working on designing my modules in such a way that they don't need to be required multiple times. In my approach, I am passing arguments from the main app.js file to all of my modules. One of the modules I have is for user login and it ...

Determine the presence of a bound column

When working with an SQL stored Procedure, I run into a situation where a certain column may or may not exist in the database based on specific values. For example, if I bind the column using <%#DataBinder.Eval(Container.DataItem, "ADDRESS1")%>, bu ...

steps for signing in to garmin account with javascript

Attempting to set up an Oauth1 login for Garmin using Angular2 and standard http calls, but encountering a pre-flight OPTIONS call error on the initial request to oauth/request_token path. It seems like CORS is not enabled or something similar. Has anyone ...

Tips for customizing standard data types in TypeScript

Currently facing a challenge where I need to update a global type. Specifically, I am looking to modify the signature of the Element.prototype.animate function to make it optional. This is the approach I attempted: declare global { interface Element { ...

Using popsicle with Node.js to handle asynchronous operations and promises

Looking for a way to optimize a function that currently makes a single API call, returning a Promise. How can we modify this code to make multiple API calls for different timestamps? The goal is to store the unaggregated data in an object with the timestam ...

Interested in creating a Twitter bot that can automatically share images from a designated folder in sequential order. Leveraging the power of node.js

Recently, I've been following an online guide to create a Twitter bot that tweets images from a folder on my computer. While I have a vast collection of photos I'd like to share, the guide only demonstrates how to post them in a random sequence. ...

Encountering an Issue while Deploying a create-react-app to Heroku

Despite trying various online remedies, I am still encountering an error while attempting to deploy a simple React.js app on Heroku. The app successfully builds when I execute git push heroku master, but upon opening it, I consistently receive an applicati ...

Implementing Express.js allows for the seamless casting of interfaces by the body within the request

I have created a similar structure to ASP.NET MVC and uploaded it on my github repository (express-mvc). Everything seems fine, but I am facing an issue with casting the body inside the request object to match any interface. This is what I am aiming for: ...

There is no record of the property's history

I am embarking on a fresh project utilizing React and TypeScript. One of the hurdles I have encountered is with the Router. Strangely, TypeScript does not recognize the history property, even though it should be accessible as mentioned in the documentation ...

Find the height of the viewport using jQuery, subtracting (n) pixels

Apologies if the topic seems puzzling, I couldn't find a better way to explain it. I utilized jQuery to adjust the height of a div to match the size of the viewport. var slidevh = function() { var bheight = $(window).height(); $(".container" ...

Tips for successfully executing queries with Axios within a Vue application

Is there a way to send query parameters using Axios so that I can access them in my backend code using req.query.email? The following approach doesn't seem to be working as expected: this.$http.post(this.$BASE_URL + 'agents/auth/create-password&a ...

When I try to import script files into my ASP.NET page, Intellisense displays the methods accurately. However, when I attempt to call one of them, an

I added a function to an existing .js file (I tried two different files) in order to make the method accessible in multiple locations without having to repeat the code. I also created a simple function just to confirm that my function wasn't causing a ...

Experience running two functions simultaneously in jQuery simulation

Presented here are two functions that I am working with: loadTop(); loadBottom(); One of these functions is responsible for loading the top portion of a page while the other takes care of loading the bottom. The loadTop function involves asynchronous o ...

Implementing a class addition on focus event using Angular 2

Currently, I am in the process of upgrading an Angular 1 application to Angular 2 and encountering an issue with one of my existing directives. The task at hand is straightforward. When an input field is focused, a class should be added (md-input-focus) a ...

Once the Ajax request is finished, the cookie deletion function ceases to function

When the website loads, a cookie is generated using PHP before any other content or headers are sent. This is done with the following code: $steam_login_verify = SteamSignIn::validate(); if(isset($_COOKIE['userid'])) { //work with cookie va ...

issue with selecting tabs in jquery

I need help with a problem that is connected to my previous article on CSS, button selection, and HTML tags. You can find the article here. I am not very proficient in JavaScript, so I would appreciate any insights or guidance on how to tackle this issue. ...

Unable to set up npm for node-resemble on macOS

Issue Encountered: Error installing node-resemble package due to missing README data and configure errors. npm install failed with exit status 1. ...

Do not let CKEditor interact with widget content

Even though the HTML content within the aside tag is not editable, CKEditor still performs content filtering and removes tags while displaying hidden input fields. Here is the relevant HTML widget code: <aside class="widget widget-form" contenteditabl ...