threadpool

Why is my WCF service only processing 3 parallel requests at a time?

倖福魔咒の 提交于 2019-12-23 19:00:01
问题 I have a WPF application doing something very simple. I just have it firing off 4 requests to a basic WCF Service . private async Task MultipleWcfCalls() { ServiceReference.Service1Client _proxy = new ServiceReference.Service1Client(); _proxy.Open(); var t1 = _proxy.GetDataAsync(0); var t2 = _proxy.GetDataAsync(0); var t3 = _proxy.GetDataAsync(0); var t4 = _proxy.GetDataAsync(0); await Task.WhenAll(t1, t2, t3, t4); } My service is doing the classic Task.Delay(3000) . public async Task<string>

Multi-threading benchmark

一曲冷凌霜 提交于 2019-12-23 16:07:09
问题 I have had a heavy mathematical computation to count the number of twin prime numbers within a range and I have divided the task between threads. Here you see the profile of the execution time against the number of threads. My questions are about justification of: Why do single thread and dual threads have very similar performance? Why there is a drop in execution time when it is 5- or 7-threaded, while execution time increases when 6 or 8 threads are used? (I have experienced that in several

Wait for tasks to get completed in threadpool

一世执手 提交于 2019-12-23 15:11:22
问题 I have created a thread pool in C++ which stores all tasks in a queue. Thread pool start n number of threads which takes tasks from queue , process each task and then delete tasks from queue. Now , I want to wait till all tasks get completed. Checking for empty queue for completion of tasks may not work as , task can be given to each thread and queue can be emptied but still the tasks can in processing mode. I am not getting idea how to wait for all the tasks completion.This is a design

Exceptions on .Net ThreadPool Threads

一世执手 提交于 2019-12-23 12:41:08
问题 Duplicate: How to catch exceptions from a ThreadPool.QueueUserWorkItem? I am queueing up multiple delegates on the .Net ThreadPool for a large number of independant remoting calls that themselves call multiple databases and other offline resources. By Queueing these calls on the ThreadPool I can run them concurrently and minimize the overall latency. private void CompleteAndQueuePayLoads(IEnumerable<UsagePayload> payLoads) { List<WaitHandle> waitHndls = new List<WaitHandle>(); foreach

How do I properly execute an Async Method in ASP.net MVC?

二次信任 提交于 2019-12-23 12:08:14
问题 How do I execute an asynchronous method from within a controller method and return an HttpStatusCodeResult(200), without the async delegate prematurely terminating its execution? I am working on an asp.net application and one of my action my home controller takes long time to run(10-30 sec). I want to return an HttpStatusCodeResult(200) and keep running my function. The functoin need not to return anything, but still it's not really a case of fire and forget since I return a response to the

Thread.CurrentThread.CurrentCulture not working in a thread inside a threadpool

拈花ヽ惹草 提交于 2019-12-23 09:16:42
问题 I have a method which will be called inside a thread and those threads are managed by threadpool. The method is calling a DLL's method which unfortunately requires a specific locale for being performed correctly. Before puting this method to be ran by threadpool, I've tested it while running in application's main thread and also while I manually manage the threads and it works fine, but when I put it into work inside a threadpool, locale is not applied and consequently the method does not

java thread pool keep running

倖福魔咒の 提交于 2019-12-22 18:40:31
问题 This is more a generic question than a specific one. I'm trying to have a multi threaded environment that stays active so that I can just submit tasks and run them. I want to do this without the hassle of executing in a web server or application server. The idea was to use a java thread pool for this, but the issue here is that the pool stays open just until my main method finishes, after which obviously it closes and the program finishes. How can I prevent this from happening? I'm sure there

Monitor ThreadPool use

拥有回忆 提交于 2019-12-22 13:57:45
问题 I wish to do some benchmarking on a busy WCF service (IIS-hosted, PerSession). Since WCF gets a new ThreadPool thread for each service call, I'd like to know if the ThreadPool's max threads count is ever reached, and if I should increase it (SetMaxThreads). The only way to get hard facts I can think of is to instrument the code with ThreadPool.GetAvailableThreads. Is there any way for me to monitor if ThreadPool has reached max threads and is waiting for threads to be released? Thanks. 来源:

How to implement thread pool that will automatically shutdown at end of execution?

*爱你&永不变心* 提交于 2019-12-22 13:01:02
问题 I'm writing a Java client which could theoretically be used in a different environment: Java main(), in a servlet container, or via dependency injection. The client implements internal connection thread pooling. The problem with this approach is that users of the client that are unaware of the fact that an internal thread pool is implemented will see his or her application "hang" on shutdown. My users need to know to send a shutdown() message to the library. I'm wondering if any other

Tomcat Thread Monitoring Mbeans Description

十年热恋 提交于 2019-12-22 12:54:26
问题 In thread related Mbeans of Tomcat I see under Catalina.ThreadPool. there are different attributes viz. maxThreads, currentThreadCount, currentThreadsBusy etc. So, where can I get the description of these Mbean attributes, what each of these attribute is indicating, I need to include this in my monitoring automation code, Which will provide the Thread utilization stats. also possible I would like to see the Source code, where can I get it? When I see the Mbean class name (through jconsole) it