How to Check Network Latency Between Servers on Linux

Step-by-step guide to check network latency between servers. Monitor network performance, detect latency issues, and optimize network connectivity.

Last updated: 2026-01-11

How to Check Network Latency Between Servers on Linux

Monitor network latency between servers to track network performance, detect connectivity issues, and optimize network configuration. This guide shows you how to check latency and set up automated monitoring.

For comprehensive network monitoring, see Network Health Monitoring. For troubleshooting network issues, see Network Connectivity Issues.

Why Checking Network Latency Matters

Network latency directly impacts application performance, especially for distributed systems and database connections. High latency causes slow response times and poor user experience. Monitoring latency helps maintain optimal network performance.

Method 1: Check Latency with ping

Measure Latency with ping

# Basic latency check
ping -c 10 server.example.com

# Get average latency
ping -c 10 server.example.com | grep "avg" | awk -F'/' '{print $5}'

# Check latency to multiple servers
for server in server1.example.com server2.example.com server3.example.com; do
  echo -n "$server: "
  ping -c 5 $server | grep "avg" | awk -F'/' '{print $5 "ms"}'
done

Monitor Latency Over Time

# Monitor latency continuously
while true; do
  LATENCY=$(ping -c 1 server.example.com | grep "time=" | awk -F'time=' '{print $2}' | awk '{print $1}')
  echo "$(date): $LATENCY ms"
  sleep 60
done

Method 2: Check Latency with traceroute

Analyze Network Path Latency

# Trace network path
traceroute server.example.com

# Get latency per hop
traceroute -n server.example.com | awk '{print $1, $3}'

# Check latency to specific hop
traceroute server.example.com | grep " 5 "

Method 3: Automated Latency Monitoring with Zuzia.app

Set up automated monitoring to track latency continuously and receive alerts when latency exceeds thresholds.

Step 1: Add Latency Monitoring Command

  1. Log in to Zuzia.app Dashboard

    • Access your Zuzia.app account
    • Navigate to your server
    • Click "Add Scheduled Task"
  2. Configure Latency Check Command

    ping -c 5 server.example.com | grep "avg" | awk -F'/' '{print $5}'
    
    • Set execution frequency (every 5-10 minutes)
    • Configure alerts when latency exceeds thresholds

Step 2: Configure Alert Thresholds

  • Warning: Latency > 50ms
  • Critical: Latency > 100ms
  • Emergency: Latency > 200ms or packet loss

Step 3: Monitor Multiple Servers

Add commands to monitor latency to multiple servers:

# Monitor latency to database server
ping -c 5 db-server.example.com | grep "avg" | awk -F'/' '{print $5}'

# Monitor latency to application server
ping -c 5 app-server.example.com | grep "avg" | awk -F'/' '{print $5}'

Best Practices for Latency Monitoring

1. Monitor Latency Continuously

  • Track latency regularly
  • Alert when latency exceeds thresholds
  • Monitor latency trends over time
  • Optimize network configuration based on data

2. Monitor Multiple Network Paths

  • Test latency to different servers
  • Monitor latency across network segments
  • Compare latency from different locations
  • Identify network bottlenecks

3. Set Appropriate Thresholds

  • Set thresholds based on application requirements
  • Adjust thresholds for different server types
  • Monitor latency percentiles
  • Alert on latency degradation

4. Correlate Latency with Other Metrics

  • Compare latency with network bandwidth
  • Correlate with application performance
  • Monitor latency during peak traffic
  • Identify performance bottlenecks

Troubleshooting Latency Issues

Step 1: Identify Latency Problems

When latency is high:

# Check current latency
ping -c 10 server.example.com

# Test latency to multiple servers
for server in server1 server2 server3; do
  ping -c 5 $server | grep "avg"
done

# Check network path
traceroute server.example.com

Step 2: Optimize Network Performance

Based on investigation:

  1. Optimize Network Configuration:

    • Tune network settings
    • Optimize routing
    • Reduce network hops
  2. Fix Network Issues:

    • Resolve network connectivity problems
    • Fix network configuration errors
    • Update network infrastructure
  3. Scale Network Infrastructure:

    • Add network capacity if needed
    • Implement network optimization
    • Upgrade network equipment

FAQ: Common Questions About Latency Monitoring

What is considered high network latency?

High latency depends on your application requirements. Generally, latency under 10ms is excellent for local networks, 10-50ms is good, 50-100ms is acceptable, and over 100ms is high. Set thresholds based on your requirements.

How often should I check network latency?

For production servers, continuous automated monitoring is essential. Zuzia.app can check latency every few minutes, storing historical data and alerting you when latency exceeds thresholds.

How do I improve network latency?

Improve network latency by optimizing network configuration, reducing network hops, using faster network connections, optimizing routing, and fixing network connectivity issues.

Can latency monitoring impact network performance?

Latency monitoring commands have minimal impact on network performance when done correctly. Use appropriate monitoring frequency and avoid excessive pings during monitoring.

Note: The content above is part of our brainstorming and planning process. Not all described features are yet available in the current version of Zuzia.

If you'd like to achieve what's described in this article, please contact us – we'd be happy to work on it and tailor the solution to your needs.

In the meantime, we invite you to try out Zuzia's current features – server monitoring, SSL checks, task management, and many more.

We use cookies to ensure the proper functioning of our website.