Skip to content

Commit

Permalink
use n-2 processes for mpindexer
Browse files Browse the repository at this point in the history
  • Loading branch information
carlvitzthum committed Sep 15, 2019
1 parent d2d0c7e commit 3782970
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/snovault/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Version information."""

# The following line *must* be the last in the module, exactly as formatted:
__version__ = "1.2.5"
__version__ = "1.2.6"
3 changes: 2 additions & 1 deletion src/snovault/elasticsearch/mpindexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,9 @@ class MPIndexer(Indexer):
def __init__(self, registry):
super(MPIndexer, self).__init__(registry)
self.chunksize = int(registry.settings.get('indexer.chunk_size', 1024))
# use 2 fewer processes than cpu count, with a minimum of 1
num_cpu = cpu_count()
self.processes = num_cpu - 1 if num_cpu > 1 else num_cpu
self.processes = num_cpu - 2 if num_cpu - 2 > 1 else 1
self.initargs = (registry[APP_FACTORY], registry.settings,)
# workers in the pool will be replaced after finishing one task
self.maxtasks = 1
Expand Down

0 comments on commit 3782970

Please sign in to comment.