Skip to content

Commit 6f369ef

Browse files
authored
Reduce the default required shm size to 1MB (triton-inference-server#291)
* Reduce the default required shm size to 1MB * Review edit
1 parent 0f2ce85 commit 6f369ef

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -852,8 +852,8 @@ Starting from 21.04 release, Python backend uses shared memory to connect
852852
user's code to Triton. Note that this change is completely transparent and
853853
does not require any change to the existing user's model code.
854854

855-
Python backend, by default, allocates 64 MBs for each model instance. Then,
856-
it will grow the shared memory region by 64 MBs whenever an increase is
855+
Python backend, by default, allocates 1 MB for each model instance. Then,
856+
it will grow the shared memory region by 1 MB chunks whenever an increase is
857857
required. You can configure the default shared memory used by each model
858858
instance using the `shm-default-byte-size` flag. The amount of shared memory
859859
growth can be configured using the `shm-growth-byte-size`.

src/python_be.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1901,8 +1901,8 @@ TRITONBACKEND_Initialize(TRITONBACKEND_Backend* backend)
19011901

19021902
std::unique_ptr<BackendState> backend_state(new BackendState());
19031903
triton::common::TritonJson::Value cmdline;
1904-
backend_state->shm_default_byte_size = 64 * 1024 * 1024; // 64 MBs
1905-
backend_state->shm_growth_byte_size = 64 * 1024 * 1024; // 64 MBs
1904+
backend_state->shm_default_byte_size = 1 * 1024 * 1024; // 1 MB
1905+
backend_state->shm_growth_byte_size = 1 * 1024 * 1024; // 1 MB
19061906
backend_state->stub_timeout_seconds = 30;
19071907
backend_state->shm_message_queue_size = 1000;
19081908
backend_state->number_of_instance_inits = 0;
@@ -1936,8 +1936,8 @@ TRITONBACKEND_Initialize(TRITONBACKEND_Backend* backend)
19361936
RETURN_IF_ERROR(shm_default_size.AsString(&shm_default_byte_size));
19371937
try {
19381938
backend_state->shm_default_byte_size = std::stol(shm_default_byte_size);
1939-
// Shared memory default byte size can't be less than 4 MBs.
1940-
if (backend_state->shm_default_byte_size < 4 * 1024 * 1024) {
1939+
// Shared memory default byte size can't be less than 1 MB.
1940+
if (backend_state->shm_default_byte_size < 1 * 1024 * 1024) {
19411941
return TRITONSERVER_ErrorNew(
19421942
TRITONSERVER_ERROR_INVALID_ARG,
19431943
(std::string("shm-default-byte-size") +

src/shm_manager.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ SharedMemoryManager::SharedMemoryManager(
7676
"' to requested size (" + std::to_string(shm_size) +
7777
" bytes). If you are running Triton inside docker, use '--shm-size' "
7878
"flag to control the shared memory region size. Each Python backend "
79-
"model instance requires at least 64MBs of shared memory. Error: " +
79+
"model instance requires at least 1 MB of shared memory. Error: " +
8080
ex.what());
8181
// Remove the shared memory region if there was an error.
8282
bi::shared_memory_object::remove(shm_region_name.c_str());

0 commit comments

Comments
 (0)