scala - Default executioncontext with blocking calls -
i understand using blocking notifies thread pool block of code pass contains long-running or blocking operations. allowing pool temporarily spawn new workers ensure starvation never happens. use blocking
blocks @ places thinking may not ideal continue using blocking
blocks default executioncontext since there must cost associated in creating temporary workers , destroying them etc. instead create separate execution context run blocking calls avoid creation/destroying costs of worker threads have enough pool size in dedicated execution context. or it's okay use 1 executioncontext , continue using blocking blocks?
basically db calls blocking , going wrapped in async{blocking{}}
(if continue using 1 executioncontext). there hundred or more dao blocking apis. , potentially thousands of users hitting system.
Comments
Post a Comment