Project

General

Profile

Actions

Cleanup #63294

open

mgr: enable per-subinterpreter GIL (Python >= 3.12)

Added by Ernesto Puerta 6 months ago.

Status:
New
Priority:
High
Assignee:
-
Category:
ceph-mgr
Target version:
% Done:

0%

Tags:
Backport:
Reviewed:
Affected Versions:
Pull request ID:

Description

Starting Python 3.12, CPython supports instantiating subinterpreters with their own GIL.

This would solve performance issues and allow ceph-mgr modules to fully utilize multiple cores (so far, ceph-mgr was performance is limited to a single core).

Additionally, this improves mgr module isolation, which could (perhaps) allow to restart only specific mgr-modules, instead of respawning the whole ceph-mgr everytime a module is enabled or disabled.

In order for this to work, the Py_NewInterpreter() has to be replaced with:

PyInterpreterConfig config = {
    .check_multi_interp_extensions = 1,
    .gil = PyInterpreterConfig_OWN_GIL,
};
PyThreadState *tstate = NULL;
PyStatus status = Py_NewInterpreterFromConfig(&tstate, &config);

Risks:
  • After this change, issues might start happening with data-sharing across sub-interpreters, like the ceph-mgr remote() method. This could still be an issue without per-subinterpreter GIL, but with independent GILs issues would be more prone to appear.
  • No major LTS distro release brings Python 3.12 (it was released by Oct 3rd, 2023). Whenever, CentOS/Ubuntu/Debian start adopting it, we'll need to provide updated packages for the Python dependencies (this could be partly solved by embedding Python deps).
Related issues: References:

Related issues 2 (1 open1 closed)

Blocks mgr - Bug #38407: Funny issues with python sub-interpretersCan't reproduce

Actions
Blocks mgr - Bug #45574: subinterpreters: ceph/mgr/rook RuntimeError on import of RookOrchestrator - ceph cluster does not startNew

Actions
Actions #1

Updated by Ernesto Puerta 6 months ago

  • Blocks Bug #38407: Funny issues with python sub-interpreters added
Actions #2

Updated by Ernesto Puerta 6 months ago

  • Blocks Bug #45574: subinterpreters: ceph/mgr/rook RuntimeError on import of RookOrchestrator - ceph cluster does not start added
Actions

Also available in: Atom PDF