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
14
votes
3 answers

How to use Python multiprocessing Pool.map to fill numpy array in a for loop

I want to fill a 2D-numpy array within a for loop and fasten the calculation by using multiprocessing. import numpy from multiprocessing import Pool array_2D = numpy.zeros((20,10)) pool = Pool(processes = 4) def fill_array(start_val): return…
MoTSCHIGGE
  • 949
  • 5
  • 12
  • 21
14
votes
1 answer

Can't pickle using python's multiprocessing Pool.apply_async()

I want to run something like this: from multiprocessing import Pool import time import random class Controler(object): def __init__(self): nProcess = 10 pages = 10 self.__result = [] …
flaviussn
  • 1,305
  • 2
  • 15
  • 33
13
votes
5 answers

Dealing with fragmentation in a memory pool?

Suppose I have a memory pool object with a constructor that takes a pointer to a large chunk of memory ptr and size N. If I do many random allocations and deallocations of various sizes I can get the memory in such a state that I cannot allocate an…
user805547
  • 1,245
  • 1
  • 15
  • 23
13
votes
1 answer

Python: How to use Value and Array in Multiprocessing pool

For multiprocessing with Process, I can use Value, Array by setting args param. With multiprocessing with Pool, how can I use Value, Array. There is nothing in the docs on how to do this. from multiprocessing import Process, Value, Array def…
Merlin
  • 24,552
  • 41
  • 131
  • 206
13
votes
2 answers

Python multiprocessing Pool on Windows 8.1 spawns only one worker

I currently have this piece of code (feel free to comment on it too :) ) def threaded_convert_to_png(self): paths = self.get_pages() pool = Pool() result = pool.map(convert_to_png, paths) self.image_path = result On an Intel i7 it…
Drakkainen
  • 1,142
  • 11
  • 25
12
votes
1 answer

What is the meaning of the last letter "a", "b", or "s" in Azure DevOps' C:\agent\_work\1\a? Anyone know what that last letter stands for?

What is the meaning of the last letter "a", "b", or "s" in Azure DevOps' directory structure: C:\agent_work\1\a C:\agent_work\1\b C:\agent_work\1\s Anyone know what that last letter stands for? Extra credit: what's the "1" represent too?
Glenn
  • 175
  • 1
  • 7
12
votes
3 answers

When NOT to use database connection pooling in Java?

I can find a lot of questions about how to use connection pooling and why it's a good idea, but I'm wondering if I actually need it. I'm creating a server application and although it is multi-threaded, I've been careful that only a single thread…
12
votes
2 answers

Python What is the difference between a Pool of worker processes and just running multiple Processes?

I am not sure when to use pool of workers vs multiple processes. processes = [] for m in range(1,5): p = Process(target=some_function) p.start() processes.append(p) for p in processes: p.join() vs if __name__ ==…
whiteSkar
  • 1,614
  • 2
  • 17
  • 30
12
votes
4 answers

Pool within a Class in Python

I would like to use Pool within a class, but there seems to be a problem. My code is long, I created a small-demo variant to illustrated the problem. It would be great if you can give me a variant of the code below that works. from multiprocessing…
user58925
  • 1,537
  • 5
  • 19
  • 28
12
votes
1 answer

Worker, Threads & Pool size using Puma

If I have a server with 1 core, how many puma workers, threads and what database pool size is appropriate? What's the general thumb here?
SandeliusME
  • 802
  • 1
  • 10
  • 19
12
votes
2 answers

Can't pickle Function

So I'm trying to speed up my computation time by doing a little bit multiprocessing I'm trying to use the pool workers. At the top of my code I have import Singal as s import multiprocessing as mp def wrapper(Channel): Noise_Frequincies = [] …
Cate Daniel
  • 724
  • 2
  • 14
  • 30
12
votes
2 answers

How to handle Python multiprocessing database concurrency, specifically with django?

So, I'm trying to write an application that uses django as its ORM, since it'll both need to do some behind the scenes processing and an easy to use front-end. It's core functionality will be processing data that's in the database, in a high-CPU…
wdahab
  • 347
  • 3
  • 14
12
votes
3 answers

How to designate a thread pool for actors

I have an existing java/scala application using a global thread pool. I would like to start using actors in the project but would like everything in the app using the same pool. I know I can set the maximum number of threads that actors use but…
agilefall
  • 3,876
  • 3
  • 31
  • 27
12
votes
1 answer

Difference between pool and cluster

From a purest perspective, they kind of feel like identical concepts. Both manage sets of reosurces/nodes and control their access from or by external components. With a pool, you borrow and return these resources/nodes to and from the pool. With a…
IAmYourFaja
  • 55,468
  • 181
  • 466
  • 756
11
votes
4 answers

String POOL in java

Java has string pool, due to which objects of string class are immutable. But my question stands - What was the need to make String POOL? Why string class was not kept like other class to hold its own values? Is internally JVM need some strings or…
Amol Ghotankar
  • 2,008
  • 5
  • 28
  • 42