“Redis 네트워크 연결이 극도로 불안정합니다”

로그에 이 메시지가 지속적으로 출력되고 있습니다. 값은 약 10만에서 약 135만 사이를 오가지만, 10만 근처의 값이 꽤 자주 나타나는 것 같습니다:

Your Redis network connection is performing extremely poorly. Last RTT readings were [97069, 103986, 98459, 100762, 381617], ideally these should be < 1000. Ensure Redis is running in the same AZ or datacenter as Sidekiq. If these values are close to 100,000, that means your Sidekiq process may be CPU-saturated; reduce your concurrency and/or see https://github.com/mperham/sidekiq/discussions/5039

이것은 Redis가 충분한 CPU를 사용하지 못하고 있다는 것을 시사할 수 있습니다. 하지만 서버 자체에는 CPU와 RAM에 여유가 충분한 것으로 보입니다.

또한:
Sidekiq is consuming too much memory (using: 3570.19M) for 'www.example.com', restarting

이는 Discourse stable 3.3.2의 올인원 app.yml을 사용하고 있습니다.

app.yml 내용:

UNICORN_SIDEKIQS: 9
DISCOURSE_SIDEKIQ_WORKERS: 5

호스트에도 다음 구성을 추가했습니다:

Sidekiq 대시보드 정보:


Redis가 1024M 메모리 사용량을 넘어서지 못하는 것으로 보입니다.

혹시 아이디어가 있으신 분, 조언 부탁드립니다! :meow_heart:

To follow up with this, I’m having this same issue with Jobs::PostAlert:

With those jobs often going up to 15 minutes when using 4 sidekiqs with 5 (default) threads with current testing. Seems like the jobs per second speed for Sidekiq is mostly dependent on how many of those jobs are being ran simultaneously and how many threads are free for the other jobs.

Increasing Sidekiqs to 6 or higher (5 threads) will increase the queue clearing speed, but postgres will crash fairly regularly (I am guessing from too many Jobs::PostAlert jobs being ran simultaneously.

This is on Stable 3.3.2. The changes and fixes from the linked thread seem to be already be implemented in 3.3.2, if I am not mistaken.

Postgres should never crash and generally indicates a postgres bug or some sort of larger problem.

Do you have logs?

Have you rebooted the server since making those kernel config changes?

Maybe

lscpu

would also be helpful

You should never bump UNICORN_SIDEKIQS that high, only increasing workers but

This should never happen.

The possibilities are:

  1. You are constrained on resources because either
    a) Your site has over grown the server resources
    b) You are misallocating resources
  2. There is a bug somewhere in the stack

I’d start making

UNICORN_SIDEKIQS: 1
DISCOURSE_SIDEKIQ_WORKERS: 20

which should release some RAM from your server.

For further information you will need to run the offending jobs in a PostgreSQL console and report what is the bottleneck.

갑자기 사라져서 죄송합니다. 답변해 주셔서 감사합니다. :slight_smile:

Redis가 느린 주요 원인은 THP가 여전히 활성화되어 있었기 때문이라고 생각합니다(비활성화되어 있다고 생각했었거든요):

PG 크래시의 경우, 제게 주된 해결책은 app.yml에 다음 내용을 추가하는 것이었습니다:

docker_args:
  - "--shm-size=34g"

값은 db_shared_buffers + 2GB로 설정했으며, db_shared_buffers는 호스트 머신의 총 RAM의 25%입니다.

기본값 512m를 오버라이드하는 부분:

질문자님의 게시글 히스토리를 다시 살펴보니, 매우 느린 Sidekiq 문제 … 대량의 읽지 않은 사용자 알림에서 32코어 128GB 서버를 매우 크고 활발한 사용자 기반과 함께 운영하고 계셨다는 것을 확인했습니다. 그런 맥락에서는 34GB가 그리 큰 수치가 아니라는 이유를 이해할 수 있습니다. 다만 맥락을 제공하기 위해, 설정의 규모를 아는 것이 도움이 될 수 있고(재미있을 수도 있습니다) - 여기에서 또는 심지어 프로필에서 그렇게 할 수 있을까요? (일일 및 월간 활성 사용자 수, 데이터베이스 백업 크기, RAM, 스왑, 디스크, CPU의 서버 구성 등.) 심지어 우리가 모두 통계 - 크고 작은 것들을 공유하는 스레드도 만들 수 있을지 모릅니다.