CrushMFT Documentation

Login frequency and slow logins#

Most servers see a few logins a minute. Some see hundreds a second: monitoring that checks every second, integration software that opens a new session for every file, a load balancer's health checks, a partner's script in a loop. This page is about seeing who logs in how often, what limits apply, and what makes logins slow.

Who connects how often#

Every single connection looks ordinary in the log. A flood only shows in totals. So the server writes one line a minute with the totals, whenever there was anything to count:

Connection rates 20:08:34 to 20:09:50: 13 connections (0.2/s) from 1 addresses; by address (open now): 127.0.0.1=13 (0.2/s, 6 open); by port: 18080=13 (0.2/s); logins: 2 (0.0/s), 0 failed; by user: alex (HTTP 127.0.0.1)=2 (0.0/s)

That is from the test server. A busy server's line names the ten busiest addresses, ports and user names, with how many more there were, and when connections were refused, how many and why:

refused: 6837 (87.7/s), by address: 198.51.100.7 (over max_connection_single_ip)=6837 (87.7/s)
Part Says
connections, by address and by port who opens connections, before any check
open now how many connections that address has open at this moment
logins, failed, by user which accounts log in, over which protocol, from where
refused connections turned away, with the reason: banned, or over max_connection_single_ip

The line is written to the server log under SERVER. There is nothing to turn on. Search the log for "Connection rates" to find them.

Behind a load balancer, every connection carries the balancer's address unless the listener reads the PROXY protocol. The user names still say who it is.

The limits#

Limit What it stops Where
connections one address may have open at the same time one client that hogs the server the server setting max_connection_single_ip
connections from one address per time floods Hammering in Banning
failed logins per time guessing the same
successful logins of one name per time scripts in a loop the same
sessions of one user at the same time, in all and per address one account used by too many Restrictions of the user
users connected to the server in all overload the server's connection limit, in General Settings

A connection over the limit of open connections per address is refused at once; the log calls it "BANNED" although no ban is set.

The load balancer's address#

The classic way to take a healthy server down is its own load balancer. All users arrive from one or two addresses. The limit per address is then a limit for everybody, and when logins get slow and connections pile up, the balancer's address goes over it, its health checks are refused, and the balancer declares the server dead.

  • Pass the clients' real addresses on with the PROXY protocol. Then every limit counts per user again. This is the real fix.
  • Until then, raise max_connection_single_ip well above the number of sessions you expect through the balancer.
  • Putting the balancer on Never ban these IPs protects it from bans. It does not lift the limit of open connections per address.

What makes a login slow#

At a login the server reads the user, the users it inherits from, and its folders. Normally that takes milliseconds. It takes long when:

Cause Sign Remedy
the users folder is on a slow or far file share every login is slow, worse under load keep it on fast local storage; in a cluster, on shared storage made for many small reads
a plugin asks a directory or a database for every login logins are as slow as that system look at that system; let the plugin keep answers for a while
a user's folder is on remote storage that answers slowly the login is quick, the first listing hangs time-outs of the item; a faster path
a password method with a very high work factor every login costs the same fixed time, and the processor is busy lower the factor, or add processors: see How passwords are stored
thousands of logins a second the "Connection rates" line find out who, and make them keep sessions open

The server reads users without making logins wait for each other: many accounts can log in at the same time, and a change to one account does not hold up the others.

A client that logs in for every file#

The best fix is on the client: one session, many transfers. Where that cannot be had:

  • give the account an SSH key instead of a password: checking a key is cheap, checking a well-stored password is deliberately not;
  • exempt the name from the limit on successful logins: Never block usernames;
  • watch its line in "Connection rates" and talk to its owner with numbers.

Monitoring#

To check that the server is alive, do not log in. Ask for the health address, which needs no login and costs nearly nothing: see API settings. A check that logs in every few seconds is a login load of its own, and a password in one more place.