silverstripe / sspak

Tool for managing bundles of db/assets from Silverstripe environments
http://silverstripe.github.io/sspak/
BSD 3-Clause "New" or "Revised" License
47 stars 34 forks source link

Reduce number of opened SSH connections #74

Closed purplespider closed 4 years ago

purplespider commented 4 years ago

Performing a simple sspak save --db user@remote:/home/site database.sspak command seems to open and close a total of 5 SSH connections.

I work with a host who limit the maximum number of SSH connections from the same IP within 1 minute to just 4, so the sspak save command causes this limit to be hit and a short block applied.

Not sure exactly why it requires 5 connections to download the database, is this an area that could be optimised?

maxime-rainville commented 4 years ago

When you say you're limited to 4 connections per minute per IP, do you mean 4 concurrent connections or 4 sequential connections?

Not super familiar with the inners of this package, but I don't think it would be trivial to restructure it so it opens 1 connection and use that for all the comms with the server.

Are you in a position to tell us who your hosting provider is? That seems like a rather weird constraints as it will prohibit a lot of automated scripts from running.

purplespider commented 4 years ago

Sequential connections. Well actually I believe both would be blocked. Basically if the total number of SSH connection attempts gets to 5 within 60 seconds the block kicks in. Regardless of whether these connections fail, are successful or have been closed.

The host is Guru.co.uk . I’ve asked if they’ll consider allowing whitelisting or increasing the limit to 10, but they’re refusing to do so on their shared/reseller servers, which is frustrating.

If someone is able to point me in the direction of why SSPak opens and closes so many connections I could see if it’s something I’d be able to optimise.

maxime-rainville commented 4 years ago

Off the top of my head, it's probably that each command gets run on its own connection.

purplespider commented 4 years ago

I've managed to persuade the host to increase the limit to 50, so this optimisation is no longer necessary for me. Thanks for your time @maxime-rainville!