Click here to Skip to main content
15,867,453 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi i am a .net web developer, currently working on a project which needs to retrieve market data from database may be called Tick Data, something like Forex Market Dynamic Price which(which dynamically updates every milliseconds)

As i said i am a .net developer so to retrieve data i am using MSSQL DB with suitable Stored Procedure and WebMethods inside ASMX for AJAX and i am calling the WebMethod from Ajax every 1000 ms.

My question is?
I have more than 50 such ajax calls with 1000 ms intervals in one page, will it not create any problem on our client's end.

As my developer pc is strong so till now i am not facing any browser sucking problems, but once or twice i kept that page idle over the browser for more than 2 hrs and it becomes irresponsible for 1 or 2 minutes after any click.

I already used signalR earlier but not satisfied so using it this way.

Here is one small ajax code sample
JavaScript
<pre><script>
    $(document).ready(function () {
        GetBalance();

        function GetBalance() {
            $.ajax({
                type: "POST",
                url: 'Default.aspx/GetBalance',
                data: "{'UserId' : '" + $("#Clientid").val() + "'}",
                dataType: "json",
                contentType: "application/json; charset=utf-8",
                success: function (response) {
                    $('#signalBalance').html('$' + response.d);

                    setTimeout(function () {
                        GetBalance();
                    }, 1000);
                },
                error: function (response) {
                    alert('Balance err: ' + response);
                }
            });
        }
    });
</script>



Suggest me if you have any important suggestion.

Regards

What I have tried:

I already used microsoft signalR with some hug classes
Posted
Updated 9-Jun-19 12:00pm
Comments
[no name] 9-Jun-19 13:20pm    
A one second response time in this scenario is like over-eating ... all day long.

Sounds like something from a Clockwork Orange.
GeoFinex 9-Jun-19 13:31pm    
So, what's should i try?

1 solution

For the infrastructure, I would actually split this up into multiple applications; this will allow you to scale the systems as needed.

Part 1 would be a windows application which is just retrieving the data from whatever source and populating your data-store.

Part 2 would be your web application to retrieve this information.

A third part could also be added, if needed; a web service inserted between your web-app and the data-source.

Now for your web application, I would suggest consolidating your multitude of Web Service endpoints which will make things a lot more efficient- the overhead associated with 50 HTTP calls is probably eating up more resources than the data processing associated with those same calls
 
Share this answer
 
Comments
GeoFinex 10-Jun-19 1:05am    
Agree, i already using a separate app to update data, but to retrieve data it must be on a single page.

It it be good to use: setTimeout(function () {}, to use these type of app or will have to move to something else like "SignalR StockTickData"

Regards

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900