Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@kvinwang
Copy link
Collaborator

@kvinwang kvinwang commented Sep 28, 2025

Usage:

Add swap_size in app-compose.json:

{
    "swap_size": "2G",
}

Or

{
    "swap_size": 2147483648,
}

@kvinwang kvinwang marked this pull request as ready for review September 28, 2025 11:46
@kvinwang kvinwang requested a review from Leechael September 29, 2025 02:24
@Leechael
Copy link
Collaborator

We should support the ability to update swap size before shipping it, because only allowing creation without the option to adjust swap size will seem strange to users.

@kvinwang
Copy link
Collaborator Author

We should support the ability to update swap size before shipping it, because only allowing creation without the option to adjust swap size will seem strange to users.

They can update the compose file and reboot the CVM. It is just not adjustable after booting at runtime.

@Leechael
Copy link
Collaborator

We should support the ability to update swap size before shipping it, because only allowing creation without the option to adjust swap size will seem strange to users.

They can update the compose file and reboot the CVM. It is just not adjustable after booting at runtime.

Does this mean the swap will always be recreated when the CVM reboots, and the mount configuration won't persist?

@kvinwang
Copy link
Collaborator Author

Does this mean the swap will always be recreated when the CVM reboots, and the mount configuration won't persist?

The swap data is on the persistent disk, but it was always removed and create a new one on each boot.
https://github.com/Dstack-TEE/dstack/pull/358/files#diff-d6725e0bb1459ef41e5975c6f4cd01db7c81d5b76297f4632b934adbbabe4729R699

@Leechael
Copy link
Collaborator

Leechael commented Sep 30, 2025

Does this mean the swap will always be recreated when the CVM reboots, and the mount configuration won't persist?

The swap data is on the persistent disk, but it was always removed and create a new one on each boot. https://github.com/Dstack-TEE/dstack/pull/358/files#diff-d6725e0bb1459ef41e5975c6f4cd01db7c81d5b76297f4632b934adbbabe4729R699

It will increase boot time. Can we log the time for swap processing?

@Leechael Leechael closed this Sep 30, 2025
@Leechael Leechael reopened this Sep 30, 2025
@kvinwang
Copy link
Collaborator Author

kvinwang commented Sep 30, 2025

Does this mean the swap will always be recreated when the CVM reboots, and the mount configuration won't persist?

The swap data is on the persistent disk, but it was always removed and create a new one on each boot. https://github.com/Dstack-TEE/dstack/pull/358/files#diff-d6725e0bb1459ef41e5975c6f4cd01db7c81d5b76297f4632b934adbbabe4729R699

It will increase boot time. Can we log the time for swap processing?

There is already timestamp in the log. It cost about 100ms to create a 16GB swap file or zvol on a new created CVM.

@Leechael Leechael merged commit d186e06 into master Sep 30, 2025
13 checks passed
@Leechael Leechael deleted the swap branch September 30, 2025 14:09
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