mrfake

Registered
Joined
May 8, 2023
Messages
2
Reaction score
1
Points
1
Age
29
Location
egypt
Site Script
XenForo
Hello my friends
My site suffers from an overload on the processing unit sometimes and I do not know the reason for it. I moved the server from VPS to a dedicated 8-core server and the problem still exists. When visits rise to 6000 visits, the site becomes very heavy and the system does not return to stability a little except when I activate the I am under attack mode on Cloudflare and I blocked the bots and the problem still exists and I do not know the reason

1.jpg


2.jpg


3.jpg
 
The issue you're facing, where your website suffers from an overload despite moving to a dedicated 8-core server, could be caused by several factors. Here are steps you can take to troubleshoot and resolve the issue:

1.​

Start by analyzing which parts of the server are overloaded: CPU, memory, or I/O. You can use tools like:

  • top or htop: To monitor CPU and memory usage.
  • iostat: To check disk I/O.
  • netstat or iftop: To monitor network connections and bandwidth.
This will help you identify whether the CPU, RAM, disk, or network is the bottleneck.

2.​

If you are using a web server like Apache or Nginx, ensure that it's optimized for high traffic. Some configurations to check include:

  • Max connections: Adjust the MaxClients (Apache) or worker_connections (Nginx) to a value that your server can handle.
  • Keep-alive: Ensure that KeepAlive is enabled and KeepAliveTimeout is set to a low value (like 2-5 seconds).
  • Connection handling: Use event-based handling in Nginx or Apache's event MPM to manage connections more efficiently.

3.​

If your site is database-driven (like MySQL/MariaDB), the database could be the bottleneck. Check for:

  • Slow queries: Enable query logging to identify slow queries with slow_query_log in MySQL.
  • Indexing: Ensure that database tables are properly indexed, especially for frequently used queries.
  • Connection pool: Use a connection pooler like MySQLTuner or pgbouncer (PostgreSQL) to manage database connections efficiently.

4.​

  • Enable full-page caching: If your site is CMS-based (like WordPress), use caching plugins like WP Super Cache or W3 Total Cache.
  • Use a reverse proxy: Set up Varnish or Nginx's cache to reduce the load on your web server and serve static content faster.
  • Leverage CDN: Cloudflare can cache static assets (CSS, JS, images) globally, reducing load on your origin server.

5.​

Even after blocking bots in Cloudflare, some resource-heavy bots might still bypass. Look for:

  • Bot traffic logs: Analyze your web server logs for repeated requests from certain IPs or user agents.
  • Rate limiting: Configure rate limiting in Cloudflare or your web server to throttle traffic from abusive IPs or bots.
Cloudflare's "I am under attack" mode could mitigate DDoS attacks, but it's also worth checking whether the rise in traffic is legitimate or related to automated traffic from bots.

6.​

If your site is custom-coded or relies heavily on server-side processing (e.g., PHP or Node.js), inefficient code could be the issue.

  • Profiling: Use tools like Xdebug (PHP) or New Relic to profile your application and identify bottlenecks.
  • Asynchronous processing: Offload non-critical tasks (like sending emails or processing large files) to background workers using queues (e.g., RabbitMQ, Redis).

7.​

An excessive number of database connections can cause the site to slow down, particularly with 6000 visitors. Ensure your database connection pooling is optimized, and reduce the connection timeouts.

8.​

If using PHP-FPM or similar process managers, ensure the process limit is configured properly. If too many PHP workers are spawned, it can overwhelm the server. Adjust the pm.max_children and related settings.

9.​

  • Minify CSS/JS: Reduce the load on your server by compressing and minifying CSS, JS, and HTML files.
  • Lazy Load Images: Implement lazy loading for images and videos to reduce the amount of data that needs to be transferred.

10.​

Check whether certain pages, APIs, or sections of your website are receiving more traffic or causing more load.

  • Use Google Analytics or Matomo to identify traffic spikes and user behavior that might be overwhelming your server.
  • Ensure you have no vulnerabilities or scripts that allow abuse (such as a vulnerable comment section, upload form, or login page).

11.​

If activating Cloudflare's "Under Attack" mode helps, the issue might be linked to DDoS attacks or malicious traffic. You can:

  • Enable WAF (Web Application Firewall) in Cloudflare to block malicious requests.
  • Block suspicious IPs or countries that are generating excessive traffic but aren't your target audience.
  • Increase security rules in Cloudflare to challenge suspicious traffic or bots.

12.​

If traffic continues to grow, consider distributing the load across multiple servers by using a load balancer like HAProxy or by scaling horizontally with cloud providers like AWS, Google Cloud, or DigitalOcean.

By following these steps and monitoring closely, you should be able to identify the root cause of the overload and improve the overall performance and stability of your website. Let me know if you need further help in any specific area!
 
قد تكون المشكلة التي تواجهها، حيث يعاني موقع الويب الخاص بك من التحميل الزائد على الرغم من الانتقال إلى خادم مخصص ذي ثمانية أنوية، ناجمة عن عدة عوامل. فيما يلي الخطوات التي يمكنك اتخاذها لاستكشاف المشكلة وحلها:

1.​

ابدأ بتحليل أجزاء الخادم التي تتعرض لضغط زائد: وحدة المعالجة المركزية، أو الذاكرة، أو وحدات الإدخال/الإخراج. يمكنك استخدام أدوات مثل:

  • top أو htop : لمراقبة استخدام وحدة المعالجة المركزية والذاكرة.
  • iostat : للتحقق من عمليات الإدخال/الإخراج على القرص.
  • netstat أو iftop : لمراقبة اتصالات الشبكة والنطاق الترددي.
سيساعدك هذا في تحديد ما إذا كانت وحدة المعالجة المركزية، أو ذاكرة الوصول العشوائي، أو القرص، أو الشبكة هي السبب.

2.​

إذا كنت تستخدم خادم ويب مثل Apache أو Nginx، فتأكد من تحسينه للتعامل مع حركة المرور الكثيفة. تتضمن بعض التكوينات التي يجب التحقق منها ما يلي:

  • الحد الأقصى للاتصالات : اضبط MaxClients (Apache) أو worker_connections (Nginx) على قيمة يمكن لخادمك التعامل معها.
  • الحفاظ على الحياة : تأكد من تمكين KeepAlive وتعيين KeepAliveTimeout على قيمة منخفضة (مثل 2-5 ثوانٍ).
  • معالجة الاتصالات : استخدم المعالجة القائمة على الأحداث في Nginx أو حدث MPM في Apache لإدارة الاتصالات بكفاءة أكبر.

3.​

إذا كان موقعك يعتمد على قاعدة بيانات (مثل MySQL/MariaDB)، فقد تكون قاعدة البيانات هي السبب. تحقق من:

  • الاستعلامات البطيئة : قم بتمكين تسجيل الاستعلامات لتحديد الاستعلامات البطيئة باستخدام slow_query_log في MySQL.
  • الفهرسة : تأكد من فهرسة جداول قاعدة البيانات بشكل صحيح، وخاصةً للاستعلامات المستخدمة بشكل متكرر.
  • مجموعة الاتصالات : استخدم مجموعة اتصالات مثل MySQLTuner أو pgbouncer (PostgreSQL) لإدارة اتصالات قاعدة البيانات بكفاءة.

4.​

  • تمكين التخزين المؤقت للصفحة بالكامل : إذا كان موقعك يعتمد على نظام إدارة المحتوى (مثل WordPress)، فاستخدم مكونات إضافية للتخزين المؤقت مثل WP Super Cache أو W3 Total Cache .
  • استخدم وكيلًا عكسيًا : قم بإعداد ذاكرة التخزين المؤقت لـ Varnish أو Nginx لتقليل الحمل على خادم الويب الخاص بك وتقديم المحتوى الثابت بشكل أسرع.
  • استفد من شبكة CDN : يمكن لـ Cloudflare تخزين الأصول الثابتة (CSS وJS والصور) على مستوى العالم، مما يقلل الحمل على خادم المصدر الخاص بك.

5.​

حتى بعد حظر الروبوتات في Cloudflare، قد تتمكن بعض الروبوتات التي تستهلك الكثير من الموارد من تجاوزها. ابحث عن:

  • سجلات حركة مرور الروبوت : قم بتحليل سجلات خادم الويب الخاص بك بحثًا عن الطلبات المتكررة من عناوين IP أو وكلاء مستخدم معينين.
  • تحديد المعدل : قم بتكوين تحديد المعدل في Cloudflare أو خادم الويب الخاص بك لتقليص حركة المرور من عناوين IP أو الروبوتات المسيئة.
قد يعمل وضع "أنا تحت الهجوم" في Cloudflare على تخفيف هجمات DDoS، ولكن من المفيد أيضًا التحقق مما إذا كان الارتفاع في حركة المرور مشروعًا أم مرتبطًا بحركة المرور الآلية من الروبوتات.

6.​

إذا كان موقعك مبرمجًا خصيصًا أو يعتمد بشكل كبير على المعالجة من جانب الخادم (على سبيل المثال، PHP أو Node.js)، فقد يكون الكود غير الفعال هو المشكلة.

  • إنشاء ملف تعريف : استخدم أدوات مثل Xdebug (PHP) أو New Relic لإنشاء ملف تعريف لتطبيقك وتحديد الاختناقات.
  • المعالجة غير المتزامنة : نقل المهام غير الحرجة (مثل إرسال رسائل البريد الإلكتروني أو معالجة الملفات الكبيرة) إلى العاملين في الخلفية باستخدام قوائم الانتظار (على سبيل المثال، RabbitMQ، Redis).

7.​

قد يؤدي العدد المفرط من اتصالات قاعدة البيانات إلى إبطاء الموقع، خاصة مع وجود 6000 زائر. تأكد من تحسين تجمع اتصالات قاعدة البيانات لديك، وقلل من مهلة الاتصال.

8.​

إذا كنت تستخدم PHP-FPM أو مديري عمليات مشابهين، فتأكد من تكوين حد العملية بشكل صحيح. إذا تم إنشاء عدد كبير جدًا من العاملين في PHP، فقد يؤدي ذلك إلى إرهاق الخادم. اضبط pm.max_children والإعدادات ذات الصلة.

9.​

  • تصغير CSS/JS : قم بتقليل الحمل على الخادم الخاص بك عن طريق ضغط وتقليل ملفات CSS وJS وHTML.
  • تحميل الصور بشكل كسول : قم بتنفيذ التحميل الكسول للصور ومقاطع الفيديو لتقليل كمية البيانات التي يلزم نقلها.

10.​

تحقق مما إذا كانت بعض الصفحات أو واجهات برمجة التطبيقات أو الأقسام في موقع الويب الخاص بك تتلقى المزيد من الزيارات أو تتسبب في زيادة التحميل.

  • استخدم Google Analytics أو Matomo لتحديد ارتفاعات الزيارات وسلوك المستخدم التي قد تؤثر سلبًا على خادمك.
  • تأكد من عدم وجود ثغرات أو نصوص برمجية تسمح بالإساءة (مثل قسم التعليقات المعرض للخطر، أو نموذج التحميل، أو صفحة تسجيل الدخول).

11.​

إذا كان تنشيط وضع "تحت الهجوم" في Cloudflare مفيدًا، فقد تكون المشكلة مرتبطة بهجمات الحرمان من الخدمة الموزعة أو حركة المرور الضارة. يمكنك:

  • قم بتمكين WAF (جدار حماية تطبيقات الويب) في Cloudflare لمنع الطلبات الضارة.
  • قم بحظر عناوين IP أو البلدان المشبوهة التي تولد حركة مرور مفرطة ولكنها ليست جمهورك المستهدف.
  • قم بزيادة قواعد الأمان في Cloudflare لتحدي حركة المرور أو الروبوتات المشبوهة.

12.​

إذا استمر نمو حركة المرور، ففكر في توزيع الحمل عبر خوادم متعددة باستخدام موازن التحميل مثل HAProxy أو عن طريق التوسع أفقيًا مع موفري الخدمات السحابية مثل AWS أو Google Cloud أو DigitalOcean.

باتباع هذه الخطوات والمراقبة عن كثب، يجب أن تكون قادرًا على تحديد السبب الجذري للحمل الزائد وتحسين الأداء العام واستقرار موقع الويب الخاص بك. أخبرني إذا كنت بحاجة إلى مزيد من المساعدة في أي مجال محدد!
Is it possible to message me on telegram?
@pharaohx1
 
730Threads
2,281Messages
62,146Members
TheChinoxLatest member
Back