Systemd-logind causes slow ssh login solution

background

See the slow solution of centOS ssh login
before, and dig deep to summarize the reasons for this article.

Introduction to systemd-logind:

Name

systemd-logind.service, systemd-logind — Login manager

Synopsis

systemd-logind.service

/usr/lib/systemd/systemd-logind

Description

systemd-logind is a system service that manages user logins. It is responsible for:

Keeping track of users and sessions, their processes and their idle state. This is implemented by allocating a systemd slice unit for each user below user.slice, and a scope unit below it for each concurrent session of a user. Also, a per-user service manager is started as system service instance of [email protected] for each user logged in.

Generating and managing session IDs. If auditing is available and an audit session ID is set for a session already, the session ID is initialized from it. Otherwise, an independent session counter is used.

Providing PolicyKit-based access for users to operations such as system shutdown or sleep

Implementing a shutdown/sleep inhibition logic for applications

Handling of power/sleep hardware keys

Multi-seat management

Session switch management

Device access management for users

Automatic spawning of text logins (gettys) on virtual console activation and user runtime directory management

question

It was found that systemd-logind on the executive machine caused a 100% CPU problem, making the login abnormally slow and consuming resources.

reason

  1. The main function of systemd-logind is to create a cgroup management object from a systemd perspective for each login session, which is more convenient to use cgroups for sessions. It is not useful in actual scenarios. Closing it will not affect normal ssh login.
  2. When there is a crond task, trigger the bug that systemd-logind is not recycled in time

Solution

close systemd-logind

systemctl stop systemd-logind

Verify that it has been fixed:
If systemd-logind status is as follows, systemd-logind has been turned off

systemctl status systemd-logind

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326528673&siteId=291194637