Speed up server startup by running asset compilation in parallel - #3093
Speed up server startup by running asset compilation in parallel#3093davestgermain wants to merge 1 commit into
Conversation
|
Seems like there's no way to use keyword arguments with the solution you've proposed. Also, under what circumstances do you expect this to run with |
|
@singingwolfboy the functions didn't need kwargs, but I can adapt it if you want. |
|
@davestgermain yeah, would you mind adding kwargs support? I want it to be easy to use this |
There was a problem hiding this comment.
max_workers=4 seems a fairly arbitrary value. Is there a way we can select a value more intelligently? If not, I'm OK with just setting it to 4, but it's worth asking.
There was a problem hiding this comment.
4 seemed reasonable given the number of cpus and the fact that most tasks will be IO bound. I believe 4 is the default, anyway.
There was a problem hiding this comment.
Can we do something like:
try:
import multiprocessing
num_cpus = multiprocessing.cpu_count()
except ImportError:
# reasonable default
num_cpus = 4
with ThreadPoolExecutor(max_workers=num_cpus) as executor:
# etc|
@singingwolfboy added kwargs support and cpu_count (multiprocessing is always available in python 2.7) |
|
@singingwolfboy Do have any guesses why this change would cause the acceptance test failures? Could it be that there's an order dependency when compiling coffeescript or sass? I made a change assuming that was the case, but the tests still failed. |
|
Not sure. Maybe the tests are starting up before all the assets are finished being compiled? |
|
This pull request needs to be rebased. Also, there's some discussion about moving from paver to invoke (see #3444) so perhaps this PR is no longer useful? |
|
I never could figure out why the tests were failing. should I remove this PR? |
|
@davestgermain that seems reasonable |
On my machine, the devstack server starts up 10 seconds faster.
@singingwolfboy @wedaly