Questions tagged [pool]

A pool describes a cache of resources that an application can draw from to save instantiation time.

Pools typically refer to database connections but the term can be applied to graphics handles, files and other run-time processes. When the use of such a resource is complete but the application is still running, it will typically return the resource to the pool rather than release it.

1504 questions
4
votes
1 answer

Python Multiprocessing speed with single process

I've found some behavior with python multiprocessing I'm having difficulties understanding. When using Pool, even if it is a single process, it performs much, much faster. Why is that? Does multiprocessing somehow optimize the code? import time from…
MattZ
  • 41
  • 3
4
votes
1 answer

Asynchronous Pool of Connections in Tornado with multiple processes

I'm using both Tornado 4.2.1 and tornadoes 2.4.1 libraries to query my Elasticsearch database and I'm looking for a way to initialize a Pool of connections to shared between several RequestHandler instances in a multiple processes service. Is it…
alauri
  • 317
  • 1
  • 4
  • 17
4
votes
1 answer

Hard-kill hanging sub-processes in Python's multiprocessing

I have a Python function that calls a wrapper to a C function (which I can't change). Most of the time the C function is very fast, but when it fails the call just hangs on forever. To palliate this, I time-out the call using multiprocessing: pool =…
Tastalian
  • 369
  • 4
  • 12
4
votes
1 answer

What does it means "corePoolSize", param of newScheduledThreadPool() method?

i dont have clear what does it means the "corePoolSize" parameter of the newScheduledThreadPool() method from class java.util.concurrent.Executors. What happen if i put a higher number value and what happen if i put a lower number value? //…
Ninja Coding
  • 1,357
  • 1
  • 16
  • 26
4
votes
2 answers

Resource pool for a data structure

When implementing an elementary data structure like stack, queues, linked list et al. should I create a resource pool(of nodes) by dynamically allocating memory in bunch or should I allocate memory separately every time I need a node?
Vaibhav Bajpai
  • 16,374
  • 13
  • 54
  • 85
4
votes
1 answer

multiprocessing.Pool and Rate limit

I'm making some API requests which are limited at 20 per second. As to get the answer the waiting time is about 0.5 secs I thought to use multiprocessing.Pool.map and using this decorator rate-limiting So my code looks like def fun(vec): #do…
rpanai
  • 12,515
  • 2
  • 42
  • 64
4
votes
1 answer

How would I go about parsing the Java class file constant pool?

According to https://en.wikipedia.org/wiki/Java_class_file#General_layout - the Java constant pool of a class file begins 10 bytes into the file. So far, I've been able to parse everything before that (magic to check if it's a classfile, major/minor…
user3530525
  • 691
  • 3
  • 8
  • 20
4
votes
0 answers

Why did Sun/Oracle not implement an object pool for java.util.regex.Pattern?

Background On every large, commercial Java project I've worked on, I come across numerous usages of Pattern.compile(...) even in code segments which are re-used many times, e.g. public String rewriteUrlWhichIsDoneABajillionTimes(final String…
errantlinguist
  • 3,658
  • 4
  • 18
  • 41
4
votes
1 answer

How to monitor HTTP connections pool?

I have an application in WebSphere Application Server and I want to monitor HTTP connections pool (currently processed HTTP connections) and log this data to file. WebSphere Application Server has it's own monitoring tool, but as I see correctly…
ctomek
  • 1,696
  • 16
  • 35
4
votes
1 answer

exception handling on background threads using Thread pool

The application I am working on uses thread pool. Here's the basic pseudo code. On the main thread foreach(Object obj in Component.GetObject()) { //Invoke the thread pool providing the call back (method to be called on the background//…
user336278
  • 61
  • 4
4
votes
3 answers

How to prevent destructors from being called on objects managed by boost::fast_pool_allocator?

I would like to take advantage of the following advertised feature of boost::fast_pool_allocator (see the Boost documentation for Boost Pool): For example, you could have a situation where you want to allocate a bunch of small objects at one…
Dan Nissenbaum
  • 13,558
  • 21
  • 105
  • 181
4
votes
1 answer

multiprocessing.Pool.apply_async on Windows

I'm trying to use a pool to farm out some subprocess calls in parallel. Everything works fine if I construct an entire iterable for the the pool and use imap, map, imap_unordered, etc. but I can't get apply_async to work. For example, this works…
Tim S.
  • 43
  • 5
4
votes
3 answers

Creating and reusing objects in python processes

I have an embarrassingly parallelizable problem consisting on a bunch of tasks that get solved independently of each other. Solving each of the tasks is quite lengthy, so this is a prime candidate for multi-processing. The problem is that solving my…
Javier
  • 722
  • 4
  • 14
4
votes
0 answers

multiprocessing pool is not catching KeyboardInterrupt

I am a little bit confused about the multiprocessing.Pool functionality. I try to use it and are interested in catching a KeyboardInterrupt. The code is somewhat like this: try: pool = multiprocessing.Pool(max_processes, _init_proc, [arg1,…
mkind
  • 2,015
  • 2
  • 20
  • 25
4
votes
1 answer

python multiprocessing with async shared numpy array: pool vs queue

I wish to generate a periodic Perlin noise on a regular grid. I need to generate several maps, and the grid are quite large, so I wanted to use multiprocessing, to generate one map per core. The maps are to be plotted on a figure, and put one after…
Napseis
  • 833
  • 2
  • 10
  • 24