Skip to content

Part of #2384: Auto checkpoint upon exceeding memory percentage or idle time - #4391

Merged
ajpotts merged 1 commit into
Bears-R-Us:masterfrom
vasslitvinov:auto-checkpoint-2
May 21, 2025
Merged

ajpotts merged 1 commit into
Bears-R-Us:masterfrom
vasslitvinov:auto-checkpoint-2

Conversation

@vasslitvinov

@vasslitvinov vasslitvinov commented May 9, 2025 •

Copy link
Copy Markdown
Contributor

Address part of #2384. Replaces #4378.

The server now automatically saves a checkpoint if memory usage exceeded a threshold or if the server has been idle for a bit. This is disabled by default, see below. Requires CheckpointMsg module. Arkouda still builds without this module.

The following server options in CheckpointMsg module control the behavior:

  • checkpointMemPct : Perform checkpointing automatically when memory usage exceeds this many percent of available memory. By default / if <=0, auto-checkpointing is not triggered by memory usage.

  • checkpointMemPctDelay : When memory exceeds the checkpointMemPct threhsold, wait for this many seconds of idle time before checkpointing. By default / if <=0, uses 5 seconds.

  • checkpointIdleTime : Perform checkpointing automatically when the server is idle for this many seconds. By default / if <=0, auto-checkpointing is not triggered by idle time.

  • checkpointCheckInterval : The auto-checkpoint implementation will wake up every this many seconds to check if a checkpoint needs to be saved due to memory usage or idle time. By default / if <=0, uses min( checkpointMemPctDelay, checkpointIdleTime ).

  • checkpointInterval : Automatic checkpointing due to memory use or idle time will wait for at least this many seconds after any completed checkpoint save or load operations, whether automatic or client-initiated. By default / if <=0, uses 3600 (one hour). This avoids overly-frequent auto-checkpointing. The server does not need not be idle during this interval. Checkpoint operations requested by the client are not subject to this delay.

If the server receives a message from the client while auto-checkpointing is in progress, it locks until auto-checkpointing completes.

This PR also introduces a framework for client testing with customer server options and invokes it as a sibling pytest command in Makefile. Such testing is configured using pytest.opts.ini and tests/optioned-server/conftest.py . It is used to test the functionality added in this PR.

While there: switch the order of error() and critical() in src/Logging.chpl to match the order in the enum; an analogous change in src/Message.chpl; open the file in read mode, not append, in io_util.delimited_file_to_dict(); added io_util.directory_exists().

Next features to implement:

  • The previous checkpoint is saved until the new checkpoint has successfully completed.
  • The server informs the client that it is auto-saving a checkpoint.
  • Tune the default thresholds, esp. checkpointInterval .
  • Do not checkpoint until the first client connects to the server and has some activity.

The module-level variable lastCkptCompletion in CheckpointMsg.chpl should be specific to each DefaultServerDaemon instance rather than be a global. This is OK for now that we have only a single instance.

@vasslitvinov
vasslitvinov marked this pull request as draft May 9, 2025 21:42
@vasslitvinov
vasslitvinov marked this pull request as ready for review May 17, 2025 06:02
@ajpotts
ajpotts requested a review from e-kayrakli May 19, 2025 13:30
Comment thread arkouda/io_util.py Resolved
Comment thread arkouda/io_util.py Resolved
@ShreyasKhandekar
ShreyasKhandekar self-requested a review May 19, 2025 20:39
Comment thread tests/optioned-server/conftest.py Resolved
Comment thread arkouda/io_util.py Resolved
Comment thread src/CheckpointMsg.chpl Resolved
Comment thread src/CheckpointMsg.chpl Resolved
@ajpotts
ajpotts enabled auto-merge May 20, 2025 22:42
@vasslitvinov vasslitvinov changed the title Auto checkpoint upon exceeding memory percentage or idle time Part of #2384: Auto checkpoint upon exceeding memory percentage or idle time May 20, 2025
@ajpotts
ajpotts added this pull request to the merge queue May 20, 2025
Merged via the queue into Bears-R-Us:master with commit aef221e May 21, 2025
@vasslitvinov
vasslitvinov deleted the auto-checkpoint-2 branch May 21, 2025 01:16
github-merge-queue Bot pushed a commit that referenced this pull request May 30, 2025
Fix a bug that prevents `tests/optioned-server/conftest.py` added in
#4391 from connecting to the server that's not on "localhost".

While there, clarify the handling of the server host and port in the
test suites:
* "Host" that comes from a command-line argument or environment variable
and defaults to `localhost` is used only in the CLIENT running mode.
* "Host" is obtained from `start_arkouda_server()`, which reads it from
`ak-server-info` that's created by the server, in GLOBAL_SERVER and
CLASS_SERVER modes.
* "Port" comes from a command-line argument or environment variable and
defaults to 5555; the port produced by `start_arkouda_server()` is
expected to be the same.

The testing frameworks store the host and the port for use in
`ak.connect()` as follows:

| suite | tests/ | benchmarks/ | benchmark_v2/ |
| :-- | :-- | :-- | :-- |
| host | `pytest.server` | `get_server_info()` | `pytest.host` |
| port | `pytest.port` | `get_server_info()` | `pytest.port` | 
| file | conftest.py | run_benchmarks.py | conftest.py |

The `host` argument of `start_arkouda_server()` has not been used for
its [intended
purpose](https://github.com/Bears-R-Us/arkouda/pull/374/files#r427210331)
since it was added in #374. I propose to remove it, which will increase
the clarity of code.

---------

Signed-off-by: Vassily Litvinov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants