2013年11月14日星期四

Method response speed issues

java, one method is to make a million cycles operation, which results in a call to the method response is very slow. However, the use asyn4j framework , I went to see the internal implementation is still to make a million cycles , but the response is very fast.
This is an asynchronous call ? May I ask what is the principle ( easy to understand ) ? Which god knows next to explain to the younger , be grateful !
------ Solution ---------------------------------------- ----
synchronous and asynchronous concepts do not know ?
------ Solution ---------------------------------------- ----
use of multi- thread , you call the method by another thread , of course, your main thread to feel fast .
------ Solution ------ --------------------------------------
order to improve the response speed , the way to have two species, multi-threading and asynchronous , based on your description , it should be used in an asynchronous , asynchronous corresponding fast, but when saving methods have been appropriate , the data are not all stored in the database do not know, looks like database can batch process data , the relevant class content is still to be learned.
------ For reference only -------------------------------------- -
asyn4j this framework is doing what ?
------ For reference only -------------------------------------- -
java , one method is to make a million cycles operation, which results in a call to the method response is very slow.
It depends on your method of execution speed , why would respond very slowly ?
------ For reference only -------------------------------------- -
framework are not magic , 1w times that execution of the framework for operation to be performed is not 1w times
------ For reference only ------------- --------------------------
because each loop in turn calls the other way , each cycle will be time-consuming when milliseconds , but ten thousand times down , this method is not executed very time consuming thing
------ For reference only ---------------------- -----------------
Yeah, so I wonder why things will use the framework to provide super- fast, normal java code will be very slow.
------ For reference only ---------------------------------------
for practical problem seeking to explain (Concepts know, but in this case is how to use it )
------ For reference only ---------------- -----------------------
I guess , too, to understand how multiple threads ? For me this, as I can not understand each cycle of operation have been a thread, ten thousand threads to operate together , all quickly ?
------ For reference only -------------------------------------- -
I guess , too, to understand how multiple threads ? For me this, as I can not understand each cycle of operation have been a thread, ten thousand threads to operate together , all quickly ?  
not like you so understanding should be understood as you opened a new thread to perform one of thy million operations , if you open ten thousand threads , then you certainly will immediately server crashes
- ----- For reference only ---------------------------------------
I guess , too, to understand how multiple threads ? For me this, as I can not understand each cycle of operation have been a thread, ten thousand threads to operate together , all quickly ?          
not like you so understanding should be understood as you opened a new thread to perform one of thy million operations , if you open ten thousand threads , then you will definitely server crashes immediately  
I still can not understand why I feel a lot faster too ? To another thread, which is not the same million cycles have to implement it ? Where is it fast ? Hope the wing !
------ For reference only -------------------------------------- -
I guess , too, to understand how multiple threads ? For me this, as I can not understand each cycle of operation have been a thread, ten thousand threads to operate together , all quickly ?                
not like you so understanding should be understood as you opened a new thread to perform one of thy million operations , if you open ten thousand threads , then you will definitely server crashes immediately          
I still can not understand why I feel a lot faster too ? To another thread, which is not the same million cycles have to implement it ? Where is it fast ? Hope the wing !  

have blocking multithreaded performance will help , you have no business scenarios , is difficult to say clearly

没有评论:

发表评论