DEV Community

Cover image for NGINX Plus R30, 1 single diagnostic file, telemetry per worker, and more
terngr
terngr

Posted on

NGINX Plus R30, 1 single diagnostic file, telemetry per worker, and more

NGINX Plus R30 ถือเป็น Commercial Version ซึ่งมีความสามารถมากกว่า มี Reliability และรองรับ Workload ใน Production ได้ดีกว่า NGINX OSS

Diagnostic Package

ฟีเจอร์นี้เข้ามาเสริมเรื่องที่ Subscription จะได้ Support เปิดเคสถามได้, สิ่งที่ตามมาคือ จะทำอย่างไรให้ Support ทำงานได้เร็วขึ้น ได้ข้อมูลเร็วขึ้น และพยายามให้ได้ครบทุกอย่างที่ต้องการในการขอครั้งเดียว
การรัน Script เก็บข้อมูลทุกอย่างจึงเป็นจุดเริ่มต้นครับ แล้ว zip เป็น single diagnostic package ส่งให้ Support
โดยปกติจะมีเครื่องมือ และขั้นตอนช่วย Investigate Diagnostic package ที่ได้ เพื่อระบุปัญหาให้เร็วขึ้น เพราะใช้เครื่องมือทำได้เร็วกว่าทำมือครับ

สิ่งที่ Diagnostic package เก็บไปนั้น NGINX เคลมว่าพยายามทำ Transparency ให้มากที่สุดโดยเปิดเผยว่ารันอะไรบ้าง เก็บอะไรบ้าง

  • NGINX Information - version, configs, process information, third-party modules, logs, and API stats and endpoints
  • System information – Host commands (ps, lsof, vmstat, etc.) อันนี้ก็แสดงถึงความ Transparency จาก NGINX
  • Service information – systemd, etc.
  • NGINX Agent – Logs and configs (if present) อันนี้เป็น Agent ที่ทำงานร่วมกับ Management Plane เช่น NGINX Management Suite เพื่อช่วยแก้ Configuration และเก็บ Metrics
  • NGINX App Protect – Logs and configs (if present)
  • Support package log – Log containing a list of all files collected Diagnostic Script

Connection telemetry per worker

worker ในที่นี้หมายถึง NGINX worker process ครับ
โดยปกติ NGINX จะเริ่มต้นที่ Master Process, จากนั้นสร้าง Worker process มารับ connections โดยจำนวนของ Worker process จะเท่ากับจำนวน CPU Cores โดย Default และปรับตั้งได้

เดิมจำนวน Connection จะนับรวม แต่ตอนนี้สามารถแยกตาม worker ได้ โดยมี PID กำกับ

Image description
จะเห็นรายละเอียด Connections และ Requests

เห็น Metrics แล้วมีประโยชน์อย่างไร
จะช่วยปรับค่าใน directive worker_connections
directive worker_connections จะเป็นจำนวน connection ที่มากที่สุดที่แต่ละ Worker process จะเปิดรับได้ Default คือ 512, แต่ Default NGINX configuration file จะใส่ค่าไว้ที่ 1024, ทั้งนี้การปรับตั้ง worker_connections ค่อนข้างมีความจำเป็นในการรับ Load ปริมาณมากๆ เช่นจะตั้ง worker จำนวนเท่าใด แต่ละ Worker ควรรับ Load ไม่เกินเท่าใด ถึงจะได้ประสิทธิภาพที่ดีที่สุด ซึ่ง telemetry ที่เพิ่มมาจะช่วยได้ครับ

เรื่องนี้ ยังอยู่ใน Avoiding the Top 10 NGINX Configuration Mistakes อันดับที่ 1 เพราะการนับจำนวน connection จะนับทั้ง request ที่เปิดจาก Client มายัง NGINX, และนับจาก request ที่เปิดจาก NGINX ไปยัง Upstream ฉะนั้นถ้า Client เรียกมา 1 ครั้ง, แต่ NGINX จะต้องเปิด Connection 2 ครั้ง, นั่นก็แสดงว่า ถ้าเราตั้งค่า worker_connections ไว้ที่ 1024 ก็จะรับ requests พร้อมๆ กันได้ไม่เกิน 512 ต่อ 1 worker นั่นเอง

deprecation of listen http2

เป็น directive ที่ deprecate ครับ สามารถแก้ไขได้โดยเปลี่ยนจาก

listen <port> http2;
Enter fullscreen mode Exit fullscreen mode

เปลี่ยนเป็น

listen <port>
http2 on;
Enter fullscreen mode Exit fullscreen mode

โดย http2 จะเป็น off โดย Default

เรื่องนี้อาจจะนานๆ เห็นครั้งนึง ก็คือ directive depreciation, ผลก็คือถ้าเราอัพเกรด NGINX เป็น version ใหม่ ก็จะทำให้ configuration เดิมใช้ไม่ได้ เป็นจุดนึงที่ต้องเช็คซึ่ง NGINX มี service ช่วยตรวจเช็คให้ครับก่อน upgrade

เคสนี้ถูก Deprecate ใน NGINX-1.25.1 ครับ release เมื่อ 2023-06-13, และ NGINX Plus R30 based on NGINX-1.25.1 จึง Deprecate การใช้ http2 ตามไปด้วย

Ref: HTTP2 module
Ref: NGINX-1.25.1
Ref: NGINX Plus R30 based on NGINX-1.25.1

นอกจากข้างต้น ก็ยังมี Features ย่อยๆ, แก้ Bug และ OS บางตัวที่ End of Life ก็จะถูกหยุด Support ไปด้วยครับ อ่าน Release Note ตัวเต็มได้ที่นี่

Top comments (0)