Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Core] Importing sky and sky.status(refresh=True) takes about 65MB / 200MB memory #4334

Open
Michaelvll opened this issue Nov 11, 2024 · 3 comments

Comments

@Michaelvll
Copy link
Collaborator

Michaelvll commented Nov 11, 2024

This affects both the unmanaged jobs on clusters and the managed jobs (each controller process has a ray driver, which consumes a lot of memory). It is also part of the reason why SkyPilot cannot run a large number of parallel-managed jobs.

To reproduce:

import psutil

# Get the memory consumption of the current process
print('Before import sky:', psutil.Process().memory_info().rss / 1024 / 1024, 'MB')

import sky

print('After import sky:', psutil.Process().memory_info().rss / 1024 / 1024, 'MB')

sky.status(refresh=True)

print('After status:', psutil.Process().memory_info().rss / 1024 / 1024, 'MB')
Before import sky: 11.6015625 MB
After import sky: 77.85546875 MB
After status: 200.34765625 MB
@Michaelvll Michaelvll changed the title [Core] Importing sky takes about 65 MB memory [Core] Importing sky and sky.status(refresh=True) takes about 65MB / 200MB memory Nov 11, 2024
@romilbhardwaj
Copy link
Collaborator

FWIW, I got slightly less drastic results on my mac:

Before import sky: 16.5625 MB
After import sky: 79.296875 MB
After status: 112.0 MB

Trying to gauge the headroom for improvement, I tried replacing sky with pandas:

Before import pandas: 18.8472 MB
After import pandas: 82.95126 MB

@Michaelvll
Copy link
Collaborator Author

Michaelvll commented Nov 12, 2024

FWIW, I got slightly less drastic results on my mac:

Before import sky: 16.5625 MB
After import sky: 79.296875 MB
After status: 112.0 MB

Trying to gauge the headroom for improvement, I tried replacing sky with pandas:

Before import pandas: 18.8472 MB
After import pandas: 82.95126 MB

It might relates to how many clusters we have in the status table and which clouds are those clusters from; more clouds means more catalog to be loaded in memory

@Michaelvll
Copy link
Collaborator Author

If the catalog is actually a main cause of the memory consumption, we can make it a daemon service running in background and let the other skypilot process communicate with it using RESTful API or grpc. ; )

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

No branches or pull requests

2 participants