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

Local storage: store files in subsubdirectories #45

Closed
Mic92 opened this issue Apr 24, 2023 · 2 comments
Closed

Local storage: store files in subsubdirectories #45

Mic92 opened this issue Apr 24, 2023 · 2 comments

Comments

@Mic92
Copy link
Contributor

Mic92 commented Apr 24, 2023

Currently it seems like all chunks end up in one big directory:

impl LocalBackend {                                                                    
▏   pub async fn new(config: LocalStorageConfig) -> ServerResult<Self> {               
▏   ▏   fs::create_dir_all(&config.path)                                               
▏   ▏   ▏   .await                                                                     
▏   ▏   ▏   .map_err(ServerError::storage_error)?;                                     
▏   ▏                                                                                  
▏   ▏   Ok(Self { config })                                                            
▏   }                                                                                  
▏                                                                                      
▏   fn get_path(&self, p: &str) -> PathBuf {
▏   ▏   self.config.path.join(p)                                                       
▏   }                                                                                  
}

This seems bad from a performance standpoint. Many file operations in the kernel require locking of the parent directory which makes them slow when having a lot of concurrency. Also thinks like listing a directory becomes quite slow this way. What are your thoughts on taking the first few bytes of the directory to compute a subdirectory instead?

@Mic92
Copy link
Contributor Author

Mic92 commented Nov 10, 2023

@zhaofengli
Copy link
Owner

Fixed by #98.

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