Trong phần tìm kiếm rơ-le, chúng tôi hiển thị một nút chấm màu vàng hổ phách ngay bên cạnh biệt danh nickname của rơ-le khi nó bị quá tải. Điều này có nghĩa là một trong nhiều những chỉ số tải (load metrics) sau đây đã được kích hoạt:

Hãy lưu ý rằng nếu một rơ-le đạt tới một trạng thái quá tải, chúng tôi sẽ hiển thị nó trong vòng 72 tiếng đồng hồ sau khi rơ-le đã được phục hồi.

Nếu bạn để ý thấy rằng rơ-le của bạn bị quá tải vui lòng hãy:

  1. Hãy kiểm tra https://status.torproject.org/ để tìm hiểu về bất kỳ những vấn đề đã biết nào trong danh mục "mạng lưới Tor Network".

  2. Hãy xem xét tinh chỉnh sysctl cho hệ thống của bạn cho sức tải mạng, bộ nhớ và CPU.

  3. Hãy xem xét bật kích hoạt MetricsPort để hiểu được điều gì đang diễn ra.

Tinh chỉnh sysctl cho mạng lưới, bộ nhớ và tải CPU

Cạn kiệt cổng port TCP

Nếu bạn đang trải nghiệm sự tắc nghẽn cổng TCP, hãy xem xét mở rộng miền cổng port cục bộ của bạn. Bạn có thể thực hiện điều đó với

# sysctl -w net.ipv4.ip_local_port_range="15000 64000"

hoặc

# echo 15000 64000 > /proc/sys/net/ipv4/ip_local_port_range

Hãy luôn nhớ rằng, việc tinh chỉnh sysctl như được mô tả là không hề bền vững, vĩnh viễn và sẽ bị mất đi khi khởi động lại. Bạn cần phải thêm cấu hình vào /etc/sysctl.conf hoặc vào một tập tin trong /etc/sysctl.d/ để làm cho nó được bền vững, vĩnh viễn.

Về MetricsPort

Để hiểu rõ tình trạng hoạt động của các rơ-le Tor và mạng lưới Tor Network, điều quan trọng là phải cung cấp và có quyền truy cập đối với các chỉ số rơ-le (relay metrics). Thông tin quá tải rơ-le đã được thêm vào các bộ mô tả rơ-le (relay descriptors) từ 0.4.6+ nhưng chỉ cho tới khi Tor >= 0.4.7.1-alpha nó mới có một giao diện khả dụng cho các chỉ số rơ-le cơ bản (underlying relay metrics): cổng port các chỉ số cơ bản (metrics port).

Việc bật kích hoạt MetricsPort

Tor cung cấp quyền truy cập tới các cổng port các chỉ số metric thông qua một tuỳ chọn cấu hình torrc được gọi là MetricsPort.

Quan trọng là để hiểu được rằng việc để lộ ra MetricsPort tor một cách công khai là điều nguy hiểm cho người sử dụng mạng lưới Tor Network, đó là lý do tại sao cổng port không được bật kích hoạt theo mặc định và quyền truy cập của nó phải được kèm cặp quản lý bởi một điều lệ chính sách truy cập. Xin hãy thực hiện các biện pháp đề phòng bổ sung và cực kỳ cẩn thận khi mở cổng port này, và đóng nó lại khi bạn đã xử lý xong lỗi bug.

Hãy giả sử rằng bạn là người dùng duy nhất trên một máy chủ đang chạy một rơ-le Tor. Bạn có thể bật kích hoạt Metrics-Port bằng cách thêm cái này vào trong tập tin torrc của bạn:

MetricsPort 127.0.0.1:9035
MetricsPortPolicy accept 127.0.0.1

Và rồi bạn sẽ có khả năng dễ dàng truy xuất các số liệu với:

# curl http://127.0.0.1:9035/metrics

theo mặc định thì là ở định dạng Prometheus.

Lưu ý: mọi người dùng trên máy chủ đó sẽ có thể truy cập các thông số rơ-le chuyển tiếp đó trong ví dụ trên. Một cách tổng quan, hãy đặt một chính sách truy cập nghiêm ngặt với MetricsPortPolicy và xem xét việc sử dụng các tính năng tường lửa của hệ điều hành của bạn để phòng thủ chuyên sâu.

Để được giải thích chi tiết hơn về MetricsPortMetricsPortPolicy xin vui lòng xem trang "man" của Tor.

Đầu ra output MetricsPort

Đây là một ví dụ về những đầu ra output gì cho phép MetricsPort sẽ tạo ra (chúng tôi đã bỏ qua bất kỳ số liệu liên quan đến kiểm soát tắc nghẽn nào vì chúng tôi vẫn cần phải ổn định giao diện đó):

# HELP tor_relay_connections Total number of opened connections
# TYPE tor_relay_connections gauge
tor_relay_connections{type="OR listener",direction="initiated",state="opened",family="ipv4"} 0
tor_relay_connections{type="OR listener",direction="initiated",state="opened",family="ipv6"} 0
tor_relay_connections{type="OR listener",direction="received",state="opened",family="ipv4"} 0
tor_relay_connections{type="OR listener",direction="received",state="opened",family="ipv6"} 0
tor_relay_connections{type="OR",direction="initiated",state="opened",family="ipv4"} 0
tor_relay_connections{type="OR",direction="initiated",state="opened",family="ipv6"} 0
tor_relay_connections{type="OR",direction="received",state="opened",family="ipv4"} 0
tor_relay_connections{type="OR",direction="received",state="opened",family="ipv6"} 0
tor_relay_connections{type="Exit",direction="initiated",state="opened",family="ipv4"} 0
tor_relay_connections{type="Exit",direction="initiated",state="opened",family="ipv6"} 0
tor_relay_connections{type="Exit",direction="received",state="opened",family="ipv4"} 0
tor_relay_connections{type="Exit",direction="received",state="opened",family="ipv6"} 0
tor_relay_connections{type="Socks listener",direction="initiated",state="opened",family="ipv4"} 0
tor_relay_connections{type="Socks listener",direction="initiated",state="opened",family="ipv6"} 0
tor_relay_connections{type="Socks listener",direction="received",state="opened",family="ipv4"} 0
tor_relay_connections{type="Socks listener",direction="received",state="opened",family="ipv6"} 0
tor_relay_connections{type="Socks",direction="initiated",state="opened",family="ipv4"} 0
tor_relay_connections{type="Socks",direction="initiated",state="opened",family="ipv6"} 0
tor_relay_connections{type="Socks",direction="received",state="opened",family="ipv4"} 0
tor_relay_connections{type="Socks",direction="received",state="opened",family="ipv6"} 0
tor_relay_connections{type="Directory listener",direction="initiated",state="opened",family="ipv4"} 0
tor_relay_connections{type="Directory listener",direction="initiated",state="opened",family="ipv6"} 0
tor_relay_connections{type="Directory listener",direction="received",state="opened",family="ipv4"} 0
tor_relay_connections{type="Directory listener",direction="received",state="opened",family="ipv6"} 0
tor_relay_connections{type="Directory",direction="initiated",state="opened",family="ipv4"} 0
tor_relay_connections{type="Directory",direction="initiated",state="opened",family="ipv6"} 0
tor_relay_connections{type="Directory",direction="received",state="opened",family="ipv4"} 0
tor_relay_connections{type="Directory",direction="received",state="opened",family="ipv6"} 0
tor_relay_connections{type="Control listener",direction="initiated",state="opened",family="ipv4"} 0
tor_relay_connections{type="Control listener",direction="initiated",state="opened",family="ipv6"} 0
tor_relay_connections{type="Control listener",direction="received",state="opened",family="ipv4"} 0
tor_relay_connections{type="Control listener",direction="received",state="opened",family="ipv6"} 0
tor_relay_connections{type="Control",direction="initiated",state="opened",family="ipv4"} 0
tor_relay_connections{type="Control",direction="initiated",state="opened",family="ipv6"} 0
tor_relay_connections{type="Control",direction="received",state="opened",family="ipv4"} 0
tor_relay_connections{type="Control",direction="received",state="opened",family="ipv6"} 0
tor_relay_connections{type="Transparent pf/netfilter listener",direction="initiated",state="opened",family="ipv4"} 0
tor_relay_connections{type="Transparent pf/netfilter listener",direction="initiated",state="opened",family="ipv6"} 0
tor_relay_connections{type="Transparent pf/netfilter listener",direction="received",state="opened",family="ipv4"} 0
tor_relay_connections{type="Transparent pf/netfilter listener",direction="received",state="opened",family="ipv6"} 0
tor_relay_connections{type="Transparent natd listener",direction="initiated",state="opened",family="ipv4"} 0
tor_relay_connections{type="Transparent natd listener",direction="initiated",state="opened",family="ipv6"} 0
tor_relay_connections{type="Transparent natd listener",direction="received",state="opened",family="ipv4"} 0
tor_relay_connections{type="Transparent natd listener",direction="received",state="opened",family="ipv6"} 0
tor_relay_connections{type="DNS listener",direction="initiated",state="opened",family="ipv4"} 0
tor_relay_connections{type="DNS listener",direction="initiated",state="opened",family="ipv6"} 0
tor_relay_connections{type="DNS listener",direction="received",state="opened",family="ipv4"} 0
tor_relay_connections{type="DNS listener",direction="received",state="opened",family="ipv6"} 0
tor_relay_connections{type="Extended OR",direction="initiated",state="opened",family="ipv4"} 0
tor_relay_connections{type="Extended OR",direction="initiated",state="opened",family="ipv6"} 0
tor_relay_connections{type="Extended OR",direction="received",state="opened",family="ipv4"} 0
tor_relay_connections{type="Extended OR",direction="received",state="opened",family="ipv6"} 0
tor_relay_connections{type="Extended OR listener",direction="initiated",state="opened",family="ipv4"} 0
tor_relay_connections{type="Extended OR listener",direction="initiated",state="opened",family="ipv6"} 0
tor_relay_connections{type="Extended OR listener",direction="received",state="opened",family="ipv4"} 0
tor_relay_connections{type="Extended OR listener",direction="received",state="opened",family="ipv6"} 0
tor_relay_connections{type="HTTP tunnel listener",direction="initiated",state="opened",family="ipv4"} 0
tor_relay_connections{type="HTTP tunnel listener",direction="initiated",state="opened",family="ipv6"} 0
tor_relay_connections{type="HTTP tunnel listener",direction="received",state="opened",family="ipv4"} 0
tor_relay_connections{type="HTTP tunnel listener",direction="received",state="opened",family="ipv6"} 0
tor_relay_connections{type="Metrics listener",direction="initiated",state="opened",family="ipv4"} 0
tor_relay_connections{type="Metrics listener",direction="initiated",state="opened",family="ipv6"} 0
tor_relay_connections{type="Metrics listener",direction="received",state="opened",family="ipv4"} 0
tor_relay_connections{type="Metrics listener",direction="received",state="opened",family="ipv6"} 0
tor_relay_connections{type="Metrics",direction="initiated",state="opened",family="ipv4"} 0
tor_relay_connections{type="Metrics",direction="initiated",state="opened",family="ipv6"} 0
tor_relay_connections{type="Metrics",direction="received",state="opened",family="ipv4"} 0
tor_relay_connections{type="Metrics",direction="received",state="opened",family="ipv6"} 0
# HELP tor_relay_connections_total Total number of created/rejected connections
# TYPE tor_relay_connections_total counter
tor_relay_connections_total{type="OR listener",direction="initiated",state="created",family="ipv4"} 0
tor_relay_connections_total{type="OR listener",direction="initiated",state="created",family="ipv6"} 0
tor_relay_connections_total{type="OR listener",direction="received",state="created",family="ipv4"} 0
tor_relay_connections_total{type="OR listener",direction="received",state="created",family="ipv6"} 0
tor_relay_connections_total{type="OR listener",direction="received",state="rejected",family="ipv4"} 0
tor_relay_connections_total{type="OR listener",direction="received",state="rejected",family="ipv6"} 0
tor_relay_connections_total{type="OR",direction="initiated",state="created",family="ipv4"} 0
tor_relay_connections_total{type="OR",direction="initiated",state="created",family="ipv6"} 0
tor_relay_connections_total{type="OR",direction="received",state="created",family="ipv4"} 0
tor_relay_connections_total{type="OR",direction="received",state="created",family="ipv6"} 0
tor_relay_connections_total{type="OR",direction="received",state="rejected",family="ipv4"} 0
tor_relay_connections_total{type="OR",direction="received",state="rejected",family="ipv6"} 0
tor_relay_connections_total{type="Exit",direction="initiated",state="created",family="ipv4"} 0
tor_relay_connections_total{type="Exit",direction="initiated",state="created",family="ipv6"} 0
tor_relay_connections_total{type="Exit",direction="received",state="created",family="ipv4"} 0
tor_relay_connections_total{type="Exit",direction="received",state="created",family="ipv6"} 0
tor_relay_connections_total{type="Exit",direction="received",state="rejected",family="ipv4"} 0
tor_relay_connections_total{type="Exit",direction="received",state="rejected",family="ipv6"} 0
tor_relay_connections_total{type="Socks listener",direction="initiated",state="created",family="ipv4"} 0
tor_relay_connections_total{type="Socks listener",direction="initiated",state="created",family="ipv6"} 0
tor_relay_connections_total{type="Socks listener",direction="received",state="created",family="ipv4"} 0
tor_relay_connections_total{type="Socks listener",direction="received",state="created",family="ipv6"} 0
tor_relay_connections_total{type="Socks listener",direction="received",state="rejected",family="ipv4"} 0
tor_relay_connections_total{type="Socks listener",direction="received",state="rejected",family="ipv6"} 0
tor_relay_connections_total{type="Socks",direction="initiated",state="created",family="ipv4"} 0
tor_relay_connections_total{type="Socks",direction="initiated",state="created",family="ipv6"} 0
tor_relay_connections_total{type="Socks",direction="received",state="created",family="ipv4"} 0
tor_relay_connections_total{type="Socks",direction="received",state="created",family="ipv6"} 0
tor_relay_connections_total{type="Socks",direction="received",state="rejected",family="ipv4"} 0
tor_relay_connections_total{type="Socks",direction="received",state="rejected",family="ipv6"} 0
tor_relay_connections_total{type="Directory listener",direction="initiated",state="created",family="ipv4"} 0
tor_relay_connections_total{type="Directory listener",direction="initiated",state="created",family="ipv6"} 0
tor_relay_connections_total{type="Directory listener",direction="received",state="created",family="ipv4"} 0
tor_relay_connections_total{type="Directory listener",direction="received",state="created",family="ipv6"} 0
tor_relay_connections_total{type="Directory listener",direction="received",state="rejected",family="ipv4"} 0
tor_relay_connections_total{type="Directory listener",direction="received",state="rejected",family="ipv6"} 0
tor_relay_connections_total{type="Directory",direction="initiated",state="created",family="ipv4"} 0
tor_relay_connections_total{type="Directory",direction="initiated",state="created",family="ipv6"} 0
tor_relay_connections_total{type="Directory",direction="received",state="created",family="ipv4"} 0
tor_relay_connections_total{type="Directory",direction="received",state="created",family="ipv6"} 0
tor_relay_connections_total{type="Directory",direction="received",state="rejected",family="ipv4"} 0
tor_relay_connections_total{type="Directory",direction="received",state="rejected",family="ipv6"} 0
tor_relay_connections_total{type="Control listener",direction="initiated",state="created",family="ipv4"} 0
tor_relay_connections_total{type="Control listener",direction="initiated",state="created",family="ipv6"} 0
tor_relay_connections_total{type="Control listener",direction="received",state="created",family="ipv4"} 0
tor_relay_connections_total{type="Control listener",direction="received",state="created",family="ipv6"} 0
tor_relay_connections_total{type="Control listener",direction="received",state="rejected",family="ipv4"} 0
tor_relay_connections_total{type="Control listener",direction="received",state="rejected",family="ipv6"} 0
tor_relay_connections_total{type="Control",direction="initiated",state="created",family="ipv4"} 0
tor_relay_connections_total{type="Control",direction="initiated",state="created",family="ipv6"} 0
tor_relay_connections_total{type="Control",direction="received",state="created",family="ipv4"} 0
tor_relay_connections_total{type="Control",direction="received",state="created",family="ipv6"} 0
tor_relay_connections_total{type="Control",direction="received",state="rejected",family="ipv4"} 0
tor_relay_connections_total{type="Control",direction="received",state="rejected",family="ipv6"} 0
tor_relay_connections_total{type="Transparent pf/netfilter listener",direction="initiated",state="created",family="ipv4"} 0
tor_relay_connections_total{type="Transparent pf/netfilter listener",direction="initiated",state="created",family="ipv6"} 0
tor_relay_connections_total{type="Transparent pf/netfilter listener",direction="received",state="created",family="ipv4"} 0
tor_relay_connections_total{type="Transparent pf/netfilter listener",direction="received",state="created",family="ipv6"} 0
tor_relay_connections_total{type="Transparent pf/netfilter listener",direction="received",state="rejected",family="ipv4"} 0
tor_relay_connections_total{type="Transparent pf/netfilter listener",direction="received",state="rejected",family="ipv6"} 0
tor_relay_connections_total{type="Transparent natd listener",direction="initiated",state="created",family="ipv4"} 0
tor_relay_connections_total{type="Transparent natd listener",direction="initiated",state="created",family="ipv6"} 0
tor_relay_connections_total{type="Transparent natd listener",direction="received",state="created",family="ipv4"} 0
tor_relay_connections_total{type="Transparent natd listener",direction="received",state="created",family="ipv6"} 0
tor_relay_connections_total{type="Transparent natd listener",direction="received",state="rejected",family="ipv4"} 0
tor_relay_connections_total{type="Transparent natd listener",direction="received",state="rejected",family="ipv6"} 0
tor_relay_connections_total{type="DNS listener",direction="initiated",state="created",family="ipv4"} 0
tor_relay_connections_total{type="DNS listener",direction="initiated",state="created",family="ipv6"} 0
tor_relay_connections_total{type="DNS listener",direction="received",state="created",family="ipv4"} 0
tor_relay_connections_total{type="DNS listener",direction="received",state="created",family="ipv6"} 0
tor_relay_connections_total{type="DNS listener",direction="received",state="rejected",family="ipv4"} 0
tor_relay_connections_total{type="DNS listener",direction="received",state="rejected",family="ipv6"} 0
tor_relay_connections_total{type="Extended OR",direction="initiated",state="created",family="ipv4"} 0
tor_relay_connections_total{type="Extended OR",direction="initiated",state="created",family="ipv6"} 0
tor_relay_connections_total{type="Extended OR",direction="received",state="created",family="ipv4"} 0
tor_relay_connections_total{type="Extended OR",direction="received",state="created",family="ipv6"} 0
tor_relay_connections_total{type="Extended OR",direction="received",state="rejected",family="ipv4"} 0
tor_relay_connections_total{type="Extended OR",direction="received",state="rejected",family="ipv6"} 0
tor_relay_connections_total{type="Extended OR listener",direction="initiated",state="created",family="ipv4"} 0
tor_relay_connections_total{type="Extended OR listener",direction="initiated",state="created",family="ipv6"} 0
tor_relay_connections_total{type="Extended OR listener",direction="received",state="created",family="ipv4"} 0
tor_relay_connections_total{type="Extended OR listener",direction="received",state="created",family="ipv6"} 0
tor_relay_connections_total{type="Extended OR listener",direction="received",state="rejected",family="ipv4"} 0
tor_relay_connections_total{type="Extended OR listener",direction="received",state="rejected",family="ipv6"} 0
tor_relay_connections_total{type="HTTP tunnel listener",direction="initiated",state="created",family="ipv4"} 0
tor_relay_connections_total{type="HTTP tunnel listener",direction="initiated",state="created",family="ipv6"} 0
tor_relay_connections_total{type="HTTP tunnel listener",direction="received",state="created",family="ipv4"} 0
tor_relay_connections_total{type="HTTP tunnel listener",direction="received",state="created",family="ipv6"} 0
tor_relay_connections_total{type="HTTP tunnel listener",direction="received",state="rejected",family="ipv4"} 0
tor_relay_connections_total{type="HTTP tunnel listener",direction="received",state="rejected",family="ipv6"} 0
tor_relay_connections_total{type="Metrics listener",direction="initiated",state="created",family="ipv4"} 0
tor_relay_connections_total{type="Metrics listener",direction="initiated",state="created",family="ipv6"} 0
tor_relay_connections_total{type="Metrics listener",direction="received",state="created",family="ipv4"} 0
tor_relay_connections_total{type="Metrics listener",direction="received",state="created",family="ipv6"} 0
tor_relay_connections_total{type="Metrics listener",direction="received",state="rejected",family="ipv4"} 0
tor_relay_connections_total{type="Metrics listener",direction="received",state="rejected",family="ipv6"} 0
tor_relay_connections_total{type="Metrics",direction="initiated",state="created",family="ipv4"} 0
tor_relay_connections_total{type="Metrics",direction="initiated",state="created",family="ipv6"} 0
tor_relay_connections_total{type="Metrics",direction="received",state="created",family="ipv4"} 0
tor_relay_connections_total{type="Metrics",direction="received",state="created",family="ipv6"} 0
tor_relay_connections_total{type="Metrics",direction="received",state="rejected",family="ipv4"} 0
tor_relay_connections_total{type="Metrics",direction="received",state="rejected",family="ipv6"} 0
# HELP tor_relay_flag Relay flags from consensus
# TYPE tor_relay_flag gauge
tor_relay_flag{type="Fast"} 0
tor_relay_flag{type="Exit"} 0
tor_relay_flag{type="Authority"} 0
tor_relay_flag{type="Stable"} 0
tor_relay_flag{type="HSDir"} 0
tor_relay_flag{type="Running"} 0
tor_relay_flag{type="V2Dir"} 0
tor_relay_flag{type="Sybil"} 0
tor_relay_flag{type="Guard"} 0
# HELP tor_relay_circuits_total Total number of circuits
# TYPE tor_relay_circuits_total gauge
tor_relay_circuits_total{state="opened"} 0
# HELP tor_relay_streams_total Total number of streams
# TYPE tor_relay_streams_total counter
tor_relay_streams_total{type="BEGIN"} 0
tor_relay_streams_total{type="BEGIN_DIR"} 0
tor_relay_streams_total{type="RESOLVE"} 0
# HELP tor_relay_traffic_bytes Traffic related counters
# TYPE tor_relay_traffic_bytes counter
tor_relay_traffic_bytes{direction="read"} 0
tor_relay_traffic_bytes{direction="written"} 0
# HELP tor_relay_dos_total Denial of Service defenses related counters
# TYPE tor_relay_dos_total counter
tor_relay_dos_total{type="circuit_rejected"} 0
tor_relay_dos_total{type="circuit_killed_max_cell"} 0
tor_relay_dos_total{type="circuit_killed_max_cell_outq"} 0
tor_relay_dos_total{type="marked_address"} 0
tor_relay_dos_total{type="marked_address_maxq"} 0
tor_relay_dos_total{type="conn_rejected"} 0
tor_relay_dos_total{type="concurrent_conn_rejected"} 0
tor_relay_dos_total{type="single_hop_refused"} 0
tor_relay_dos_total{type="introduce2_rejected"} 0
# HELP tor_relay_load_onionskins_total Total number of onionskins handled
# TYPE tor_relay_load_onionskins_total counter
tor_relay_load_onionskins_total{type="tap",action="processed"} 0
tor_relay_load_onionskins_total{type="tap",action="dropped"} 0
tor_relay_load_onionskins_total{type="fast",action="processed"} 0
tor_relay_load_onionskins_total{type="fast",action="dropped"} 0
tor_relay_load_onionskins_total{type="ntor",action="processed"} 0
tor_relay_load_onionskins_total{type="ntor",action="dropped"} 0
tor_relay_load_onionskins_total{type="ntor_v3",action="processed"} 0
tor_relay_load_onionskins_total{type="ntor_v3",action="dropped"} 0
# HELP tor_relay_exit_dns_query_total Total number of DNS queries done by this relay
# TYPE tor_relay_exit_dns_query_total counter
tor_relay_exit_dns_query_total 0
# HELP tor_relay_exit_dns_error_total Total number of DNS errors encountered by this relay
# TYPE tor_relay_exit_dns_error_total counter
tor_relay_exit_dns_error_total{reason="success"} 0
tor_relay_exit_dns_error_total{reason="format"} 0
tor_relay_exit_dns_error_total{reason="serverfailed"} 0
tor_relay_exit_dns_error_total{reason="notexist"} 0
tor_relay_exit_dns_error_total{reason="notimpl"} 0
tor_relay_exit_dns_error_total{reason="refused"} 0
tor_relay_exit_dns_error_total{reason="truncated"} 0
tor_relay_exit_dns_error_total{reason="unknown"} 0
tor_relay_exit_dns_error_total{reason="tor_timeout"} 0
tor_relay_exit_dns_error_total{reason="shutdown"} 0
tor_relay_exit_dns_error_total{reason="cancel"} 0
tor_relay_exit_dns_error_total{reason="nodata"} 0
# HELP tor_relay_load_oom_bytes_total Total number of bytes the OOM has freed by subsystem
# TYPE tor_relay_load_oom_bytes_total counter
tor_relay_load_oom_bytes_total{subsys="cell"} 0
tor_relay_load_oom_bytes_total{subsys="dns"} 0
tor_relay_load_oom_bytes_total{subsys="geoip"} 0
tor_relay_load_oom_bytes_total{subsys="hsdir"} 0
# HELP tor_relay_load_socket_total Total number of sockets
# TYPE tor_relay_load_socket_total gauge
tor_relay_load_socket_total{state="opened"} 0
tor_relay_load_socket_total 0
# HELP tor_relay_load_tcp_exhaustion_total Total number of times we ran out of TCP ports
# TYPE tor_relay_load_tcp_exhaustion_total counter
tor_relay_load_tcp_exhaustion_total 0
# HELP tor_relay_load_global_rate_limit_reached_total Total number of global connection bucket limit reached
# TYPE tor_relay_load_global_rate_limit_reached_total counter
tor_relay_load_global_rate_limit_reached_total{side="read"} 0
tor_relay_load_global_rate_limit_reached_total{side="write"} 0

Hãy cùng tìm hiểu xem một số dòng như thế này thực sự nghĩa là gì nào:

tor_relay_load_onionskins_total{type="ntor",action="dropped"} 0

Khi một rơ-le bắt đầu thấy được sự tụt rớt "dropped", đó thông thường là một vấn đề về CPU/RAM.

Đáng tiếc thay, Tor chỉ có một nguồn đơn (single threaded) ngoại trừ khi các "Onion Skins" được xử lý. "Onion Skins" là các công việc mã hoá, cần được hoàn thành trên các lớp onion "Onion Layers" trong mỗi một mạch nối.

Khi tor xử lý các lớp (layers) chúng tôi sử dụng một Thread-Pool và điều ngoại (outsource) tất cả các công việc đó sang pool đó. Có thể xảy ra trường hợp pool này bắt đầu ngừng hoạt động do áp lực từ bộ nhớ hoặc CPU và điều này sẽ gây ra trạng thái quá tải.

Nếu máy chủ của bạn đang chạy theo tải trọng của chúng thì điều này sẽ có khả năng được kích hoạt.

tor_relay_exit_dns_error_total{...}

Bất kỳ bộ đếm nào trong miền "*_dns_error_total" (ngoài bộ đếm cho các yêu cầu query thành công) chỉ báo một vấn đề tiềm ẩn liên quan đến DNS. Thay vào đó, chúng tôi đã nhận ra trong chu kỳ phát hành phiên bản 0.4.7 rằng các lỗi DNS quá là ồn ào và có chứa qua nhiều các dấu hiệu tích cực giả có thể đem lợi ích cho các mục đích báo cáo quá tải. Chúng tôi do đó không sử dụng chúng nữa cho mục đích đó bắt đầu với 0.4.6.9 và 0.4.7.4-alpha. Thay vào đó, chúng tôi vẫn giữ các chỉ số DNS metrics để cho điều hành viên rơ-le một cái nhìn về những gì đang diễn ra với rơ-le của họ.

Các vấn đề Hết thời gian DNS (DNS timeout) và các lỗi chỉ áp dụng cho các nút giao đầu ra exit (Exit node).

tor_relay_load_oom_bytes_total{...}

Một yêu cầu hết bộ nhớ (Out-Of-Memory) chỉ báo một vấn đề về RAM. Rơ-le có thể cần thêm RAM hoặc nó đang bị tràn bộ nhớ. Nếu bạn lưu ý thấy rằng quá trình tor đang làm tràn bộ nhớ, xin hãy báo cáo lại vấn đề thông qua gitLab Tor hoặc gửi một email tới danh sách thư gửi các rơ-le tor.

Tor có bộ xử lý OOM (OOM handler) của chính nó và được gọi lên khi 75%, của tổng lượng bộ nhớ mà tor nghĩ rằng là khả dụng, đã đạt đến được. Do đó, nếu cho rằng tor nghĩ rằng nó cần sử dụng tổng cộng 2GB thì tại 1.5GB bộ nhớ sử dụng, nó sẽ bắt đầu dọn dẹp bộ nhớ. Đó được xem là trạng thái quá tải.

Để ước lượng số lượng bộ nhớ nó có sẵn khả dụng, khi tor khởi động, nó sẽ sử dụng MaxMemInQueues hoặc, nếu không được cài đặt, nó sẽ nhìn vào tổng lượng RAM khả dụng trên hệ thống và áp dụng thuật toán này:

    if RAM >= 8GB {
      memory = RAM * 40%
    } else {
      memory = RAM * 75%
    }
    /* Capped. */
    memory = min(memory, 8GB) -> [8GB on 64bit and 2GB on 32bit)
    /* Minimum value. */
    memory = max(250MB, memory)

Để phòng tránh trạng thái quá tải, chúng tôi khuyến nghị chạy một rơ-le vượt trên 2GB RAM trên 64bit. 4GB được khuyến nghị, mặc dù tất nhiên là nó chẳng gây hại gì khi thêm một vài RAM nếu bạn cần.

Chúng ta có thể nhận thấy rằng Tor có thể được gọi triệu tập bởi chính trình xử lý OS OOM (OS OOM Handler). Bởi vì tor chiếm hữu tổng bộ nhớ trên hệ thống khi nó khởi chạy, nếu toàn bộ hệ thống có nhiều những ứng dụng khác đang chạy sử dụng RAM, kết cục là nó sẽ tiêu tốn quá nhiều bộ nhớ. Trong trường hợp này, hệ điều hành có thể OOM Tor, mà không để cho Tor có thể nhận ra được áp lực bộ nhớ.

tor_relay_load_socket_total

Nếu số lượng các socket được mở gần bằng hoặc tương đương như tổng số lượng các socket khả dụng thì điều này chỉ báo rằng rơ-le đang hết dần các socket. Giải pháp đó là tăng ulimit -n cho quá trình tor.

tor_relay_load_tcp_exhaustion_total

Các dòng này chỉ báo rằng rơ-le đang hết dần các cổng port TCP.

Hãy thử tinh chỉnh sysctl như được mô tả bên trên.

tor_relay_load_global_rate_limit_reached_total

Nếu bộ đếm này tăng lên theo một số lượng đáng lưu ý trong một khoảng thời gian ngắn, thì đó là rơ-le bị tắc nghẽn. Nó rất có khả năng được sử dụng như là một Guard bảo vệ bởi một dịch vụ onion lớn hoặc cho một cuộc tấn công DDoS trên mạng.

Nếu rơ-le của bạn vẫn bị quá tải và bạn không thể biết được tại sao, xin vui lòng liên hệ tới network-report@torproject.org. Bạn có thể mã hoá email của bạn sử dụng khoá key báo cáo mạng Network-Report OpenPGP key.