[GH-ISSUE #1288] مصرف بالای cpu #879

Closed
opened 2026-10-31 20:15:03 +07:00 by bsakaguchi · 4 comments
Owner

Originally created by @m484r on GitHub (Dec 5, 2023).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/1288

Welcome

  • Yes, I'm using the latest major release. Only such installations are supported.
  • Yes, I'm using the supported system. Only such systems are supported.
  • Yes, I have read all WIKI document,nothing can help me in my problem.
  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've included all information below (version, config, log, etc).

Description of the problem,screencshot would be good

سلام وقت بخیر
چطوری این مصرف بالای cpu رو از بین ببرم؟
من 5 تا سرور دارم ولی فقط این یکی اینطوری شده
از طرفی رو همه کانفیگ ها ip limit گذاشته بودم که سعی کردم همشو حذف کنم و fail2ban رو هم فعال کردم
کلا تمام تاپیک ها رو خوندم و انجام دادم ولی مشکل حل نشد
حتی سرور رو هم ارتقا دادم به 16 هسته ای ولی بازم بالای 70 درصد cpu در گیر میشه و xray ری استارت میشه و کندی سرعت و قطعی پیش میاد
1

Version of 3x-ui

# 1.7.9

x-ui log reports or xray log

# xray
Originally created by @m484r on GitHub (Dec 5, 2023). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/1288 ### Welcome - [X] Yes, I'm using the latest major release. Only such installations are supported. - [X] Yes, I'm using the supported system. Only such systems are supported. - [X] Yes, I have read all WIKI document,nothing can help me in my problem. - [X] Yes, I've searched similar issues on GitHub and didn't find any. - [X] Yes, I've included all information below (version, config, log, etc). ### Description of the problem,screencshot would be good سلام وقت بخیر چطوری این مصرف بالای cpu رو از بین ببرم؟ من 5 تا سرور دارم ولی فقط این یکی اینطوری شده از طرفی رو همه کانفیگ ها ip limit گذاشته بودم که سعی کردم همشو حذف کنم و fail2ban رو هم فعال کردم کلا تمام تاپیک ها رو خوندم و انجام دادم ولی مشکل حل نشد حتی سرور رو هم ارتقا دادم به 16 هسته ای ولی بازم بالای 70 درصد cpu در گیر میشه و xray ری استارت میشه و کندی سرعت و قطعی پیش میاد ![1](https://github.com/MHSanaei/3x-ui/assets/123161750/882ffdb4-5540-480b-abdc-6f5ac556ef04) ### Version of 3x-ui <details> ```console # 1.7.9 ``` </details> ### x-ui log reports or xray log <details> ```console # xray ``` </details>
Author
Owner

@m484r commented on GitHub (Dec 7, 2023):

نه تانل هستش
سرور هم عوض کردم خوب نشده

<!-- gh-comment-id:1844197568 --> @m484r commented on GitHub (Dec 7, 2023): نه تانل هستش سرور هم عوض کردم خوب نشده
Author
Owner

@mehdikhody commented on GitHub (Feb 3, 2024):

After a few days, I realized that if you enable access logging, the xray core indefinitely adds logs to the access.log file, and after a day or two, the file size becomes excessively large.

github.com/XTLS/Xray-core@ad3d347cfc/common/log/logger.go (L164)

For Developers

There is a memory leak when the panel tries to load the entire file initially, resulting in a significant consumption of RAM and processing power. If the log file is very large, using ReadFile to read the entire file into memory at once can potentially lead to memory issues, including running out of memory or causing excessive memory consumption. It's important to be mindful of memory usage, especially when dealing with large files. If the file size is too large to fit comfortably in memory, consider reading the file in chunks using Open and file.Read to process the data incrementally.

github.com/MHSanaei/3x-ui@f0e9aa0b8f/web/job/check_client_ip_job.go (L100)

github.com/MHSanaei/3x-ui@f0e9aa0b8f/web/job/check_client_ip_job.go (L154)

For Consoomers

✅ To resolve the issue, periodically delete the access.log file or remove it entirely from the settings.

  "log": {
    "loglevel": "error",
    "error": "./error.log"
  },

https://xtls.github.io/en/config/log.html#logobject

💯 You should choose between limiting user IPs or prioritizing server performance and speed. Additionally, I have tested the IP limitation, and it is not very accurate. Therefore, it is better to disable it for the sake of performance.

<!-- gh-comment-id:1925150499 --> @mehdikhody commented on GitHub (Feb 3, 2024): After a few days, I realized that if you enable access logging, the xray core indefinitely adds logs to the `access.log` file, and after a day or two, the file size becomes excessively large. https://github.com/XTLS/Xray-core/blob/ad3d347cfc1fada5e951ebcd3de9696f69a1f927/common/log/logger.go#L164 ## For Developers There is a memory leak when the panel tries to load the entire file initially, resulting in a significant consumption of RAM and processing power. If the log file is very large, using `ReadFile` to read the entire file into memory at once can potentially lead to memory issues, including running out of memory or causing excessive memory consumption. It's important to be mindful of memory usage, especially when dealing with large files. If the file size is too large to fit comfortably in memory, consider reading the file in chunks using `Open` and `file.Read` to process the data incrementally. https://github.com/MHSanaei/3x-ui/blob/f0e9aa0b8f1b81aef76246fb7ea449dc9236deba/web/job/check_client_ip_job.go#L100 https://github.com/MHSanaei/3x-ui/blob/f0e9aa0b8f1b81aef76246fb7ea449dc9236deba/web/job/check_client_ip_job.go#L154 ## For Consoomers ✅ **To resolve the issue, periodically delete the `access.log` file or remove it entirely from the settings.** ```json "log": { "loglevel": "error", "error": "./error.log" }, ``` https://xtls.github.io/en/config/log.html#logobject 💯 You should choose between limiting user IPs or prioritizing server performance and speed. Additionally, I have tested the IP limitation, and it is not very accurate. Therefore, it is better to disable it for the sake of performance.
Author
Owner

@MHSanaei commented on GitHub (Feb 3, 2024):

اگر ای پی لیمیت فعال باشه و شما access log و fail2ban نصب نداشته باشید cpu بالا میره
داخل logsهم میتونید warning هارو ببینید
راه حل هم اینه یا موارد لازم رو نصب و اضافه کنید یا ای پی لیمیت رو غیرفعال کنید

<!-- gh-comment-id:1925202019 --> @MHSanaei commented on GitHub (Feb 3, 2024): اگر ای پی لیمیت فعال باشه و شما access log و fail2ban نصب نداشته باشید cpu بالا میره داخل logsهم میتونید warning هارو ببینید راه حل هم اینه یا موارد لازم رو نصب و اضافه کنید یا ای پی لیمیت رو غیرفعال کنید
Author
Owner

@mehdikhody commented on GitHub (Feb 3, 2024):

اگر ای پی لیمیت فعال باشه و شما access log و fail2ban نصب نداشته باشید cpu بالا میره داخل logsهم میتونید warning هارو ببینید راه حل هم اینه یا موارد لازم رو نصب و اضافه کنید یا ای پی لیمیت رو غیرفعال کنید

تمامی موارد نصب شده اما من همچنان این مشکل را داشتم و تصمیم گرفتم کلا از این ویژگی استفاده نکنم.

Fail2ban is already installed.
<!-- gh-comment-id:1925208774 --> @mehdikhody commented on GitHub (Feb 3, 2024): > اگر ای پی لیمیت فعال باشه و شما access log و fail2ban نصب نداشته باشید cpu بالا میره داخل logsهم میتونید warning هارو ببینید راه حل هم اینه یا موارد لازم رو نصب و اضافه کنید یا ای پی لیمیت رو غیرفعال کنید تمامی موارد نصب شده اما من همچنان این مشکل را داشتم و تصمیم گرفتم کلا از این ویژگی استفاده نکنم. ``` Fail2ban is already installed. ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#879
No description provided.