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

Handle ulimit #44

Closed
Fizzadar opened this issue Jul 1, 2016 · 2 comments
Closed

Handle ulimit #44

Fizzadar opened this issue Jul 1, 2016 · 2 comments
Assignees

Comments

@Fizzadar
Copy link
Member

Fizzadar commented Jul 1, 2016

When deploying to lots of hosts, using lots of files, pyinfra often hits the file open limit. This is because a new file object is opened per-file, per-host (so uploading the same file in parallel work). Use Python's resource module to guestimate good values for config.PARALLEL.

During an operation, possible open files/host:

  1. Main one for commands
  2. Second SFTP connection
  3. Local file for SFTP
  4. Two per nested local Popen commands (callbacks)
  5. Nested fact commands (callbacks) uses main SSH connection

Max files / host should be 3 - which is SSH + Popen. SFTP uses main SSH connection and file handle is closed immediately after - so will never clash with Popen/etc.

@Fizzadar Fizzadar self-assigned this Jul 1, 2016
@Fizzadar
Copy link
Member Author

Fizzadar commented Jul 4, 2016

Min open files and host counts (using local.shell within a callback` and a file upload via SFTP):

25 files / 5 hosts
28 files / 6 hosts
31 files / 7 hosts

IE: hosts * 3 + 10 seems to be the magic formula for nofile ulimit.

@Fizzadar
Copy link
Member Author

Fizzadar commented Jul 6, 2016

19b228f

@Fizzadar Fizzadar closed this as completed Jul 6, 2016
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

1 participant