Last post Jan 05, 2016 01:52 PM by Navin Dhananshan
Oct 26, 2015 05:27 PM|2xo1|LINK
webmethod + angular + mongoDB-3(driver 2.1)
i got ajax call to a webmethod performing one linear task -
which is getting data from mongoDB database(the new driver which is all -->> async!),
calculate the data, and return result.
is there is any point to use async calling the database?
Oct 27, 2015 05:31 AM|sw-ing|LINK
please refer to this
Oct 27, 2015 06:01 AM|sp00k|LINK
the point is that there is no waiting for your users, and if you really want to let your users wait you can do this with a loading bar or something. using async calls like angular does makes your application smooth running. the async calls to the database
are usefull if you have methods with several queries in one method :) as normally it will wait for the first query to finish before starting the next one in async this will go allot faster as 3 queries in one method would be executed simultaneous.
Oct 27, 2015 06:16 AM|2xo1|LINK
thank you for last post,
my question was regarding server side call to the database when the client is ajax.
(i am aware of the possibility of doing the business layer in mongoDB as well.. but this is not what i have asked .. and i am using c# for server.)
if the program will have to wait to the database data in order to calc the coming data
- what is the point for calling with an extra worker?
the new mongoDB driver is all async - and i dont think it suit for simple operations.. what do you think?
Oct 27, 2015 06:44 AM|francesco abbruzzese|LINK
The point for creating a parallel thread is to avoid to block an asp.net active while waiting for a long time operation to complete, and instead creating a lighter thread. Asp.net threads waste resources, so it is not convenient to keep them active but doing
Oct 27, 2015 08:00 AM|PatriceSc|LINK
AFAIK it is :
- if you can do some other operation, it can improve performance
- else it should be mainly a scalability concern thought it might be noticeable only with a site with enough traffic
Oct 28, 2015 12:52 PM|2xo1|LINK
but the program will have to wait to the database any how.. with the parallel or without..
Oct 28, 2015 01:13 PM|2xo1|LINK
ya.. that is my point..
for single operations - i cant find a good reason to use async.. on the contrary its cost more and give less..
therefor having a driver that could give you only asnc - is understandable.
Oct 28, 2015 06:07 PM|PatriceSc|LINK
AFAIK it might use a low level mechanism known as "IO Completion Ports". I'm really not sure but my understanding is basically that it is *ALREADY* an efficient async IO mechanism that is still exposed usually for compatibility reasons as synchronous APIs.
So exposing the true async nature of this low level mechanism would really allow to remove this intermediate wait level and enhance scalability. Needs some fact checking here as it is based on old souvenirs and guesses...
I agree it might be better to let us choose and as I said earlier it would be likely better to discuss that in a support forum for this driver. I can understand that at some point moving to async APIs server side might be worth for large scale hosting services
(though still a guess).
Dec 01, 2015 12:42 PM|john.angularjs|LINK
If you are using DML command, the asynchronous will be useful.
Jan 05, 2016 01:52 PM|Navin Dhananshan|LINK
The main reason for using Async on server side is because IIS has limited number of thread pool. for an example if IIS has allocated 2000 then only 2000 request can serve at a time. but if its async then then the new request don't need to wait till a request
gets complete. This is the one of the main reason for async.
I hope this helps to differentiate ajax on client side and async on server side. So your ajax will not exactly help the async database but it will help you to stop freezing your client.