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
20
votes
2 answers

Why do we need to set Min pool size in ConnectionString

For SQL connection pool, why do we need to set up a min pool size? As connections will be saved in the connection pool and reused, why do we need to keep live connections specified by the min pool size? Thanks.
Helic
  • 907
  • 1
  • 10
  • 25
19
votes
1 answer

Use Python Pool with context manager or close and join

The Python documentation has examples in the format of with Pool() as p: p.map(do) but I see a lot of people using the format below. p = Pool() p.map(do) p.close() p.join() Which is more desirable?
Seung
  • 763
  • 1
  • 7
  • 19
18
votes
3 answers

How to create an object pool to be able to borrow and return objects

I wanted to know that, is it possible to create a pool of objects? So that I can take an object from the pool and once I'm done with the work, I can put it into the pool.
Ravi Bhojani
  • 1,032
  • 1
  • 13
  • 24
18
votes
1 answer

Can we access or query the Java String intern (constant) pool?

Is there are way to access the contents of the String constant pool within our own program? Say I have some basic code that does this: String str1 = "foo"; String str2 = "bar"; There are now 2 strings floating around in our String constant pool.…
CODEBLACK
  • 1,239
  • 1
  • 15
  • 26
17
votes
1 answer

Python multiprocessing pool: maxtasksperchild

I have been dabbling with Python's multiprocessing library and although it provides an incredibly easy to use API, it's documentation is not always very clear. In particular, the argument 'maxtasksperchild' passed to an instance of the Pool class I…
Marnix.hoh
  • 1,556
  • 1
  • 15
  • 26
17
votes
2 answers

Node.js and MongoDB, reusing the DB object

I'm new to both Node.js and MongoDB, but I've managed to put some parts together from SO and the documentation for mongo. Mongo documentetion gives the example: // Retrieve var MongoClient = require('mongodb').MongoClient; // Connect to the…
user2288749
  • 195
  • 1
  • 1
  • 6
17
votes
1 answer

what's the difference between boost::pool<>::malloc and boost::pool<>::ordered_malloc, and when should I use boost::pool<>::ordered_malloc?

I'm using boost.pool, but I don't know when to use boost::pool<>::malloc and boost::pool<>::ordered_malloc? so, what's the difference of boost::pool<>::malloc and boost::pool<>::ordered_malloc? when should I use boost::pool<>::ordered_malloc?
superK
  • 3,932
  • 6
  • 30
  • 54
17
votes
3 answers

When does the pool change?

I have two questions: public static void main(String[] args) { String s1 = "bla"; String s2 = "b" +"l" + "a"; String s3 = "b".concat("l").concat("a"); if(s1 == s2) System.out.println("Equal"); else System.out.println("Not…
Maroun
  • 94,125
  • 30
  • 188
  • 241
16
votes
3 answers

How to replace default hikari cp to tomcat pool on spring boot 2.0

I have migrated spring boot application to 2.0 and found out some problems with hikari connection pool. When I am fetching database data this results to hikari cp timeout ie. connection is not available. I don't know why when in the previous version…
Luke
  • 1,163
  • 2
  • 11
  • 19
16
votes
1 answer

Minimize overhead in Python multiprocessing.Pool with numpy/scipy

I've spent several hours on different attempts to parallelize my number-crunching code, but it only gets slower when I do so. Unfortunately, the problem disappears when I try to reduce it to the example below and I don't really want to post the…
Han-Kwang Nienhuys
  • 3,084
  • 2
  • 12
  • 31
16
votes
2 answers

python multiprocessing pool: how can I know when all the workers in the pool have finished?

I am running a multiprocessing pool in python, where I have ~2000 tasks, being mapped to 24 workers with the pool. each task creates a file based on some data analysis and webservices. I want to run a new task, when all the tasks in the pool were…
Dror Hilman
  • 6,837
  • 9
  • 39
  • 56
16
votes
4 answers

How to terminate multiprocessing Pool processes?

I'm working on a renderfarm, and I need my clients to be able to launch multiple instances of a renderer, without blocking so the client can receive new commands. I've got that working correctly, however I'm having trouble terminating the created…
tk421storm
  • 333
  • 1
  • 2
  • 10
15
votes
1 answer

Using `Rack::Session::Pool` over `Rack::Session::Cookie`

What are the different use cases of Rack::Session::Pool and Rack::Session::Cookie? As far as I understand (correct me if I'm wrong): Cookie stores all the session key:value pairs directly within the cookie (marshalled) Pool only stores an id in…
pje
  • 21,801
  • 10
  • 54
  • 70
14
votes
4 answers

Python: How can I check the number of pending tasks in a multiprocessing.Pool?

I have a small pool of workers (4) and a very large list of tasks (5000~). I'm using a pool and sending the tasks with map_async(). Because the task I'm running is fairly long, I'm forcing a chunksize of 1 so that one long process can't hold up…
jkeating
  • 1,154
  • 1
  • 9
  • 12
14
votes
1 answer

Create objects in GenericObjectPool

I'm doing research on GenericObjectPool by putting Cipher in pool so it can be reused. GenericObjectPool pool; CipherFactory factory = new CipherFactory(); this.pool = new…
Tony
  • 2,515
  • 14
  • 38
  • 71