All Products
Search
Document Center

Elastic Compute Service:Enable PTP clock synchronization for ECS instances

Last Updated:May 15, 2026

Precision Time Protocol (PTP) delivers sub-microsecond clock synchronization with hardware timestamps for distributed systems, such as high-frequency financial trading.

What is PTP

Important

The PTP time synchronization feature is currently in invitational preview. To use this feature, submit a ticket to apply.

Precision Time Protocol (PTP) is a high-precision time synchronization protocol based on IEEE 1588. PTP uses hardware timestamps, dynamic path compensation, and master-slave clock negotiation to overcome the millisecond-level accuracy limit of Network Time Protocol (NTP), which is caused by software processing latency and network jitter. PTP delivers sub-microsecond synchronization for distributed systems.

Compared to NTP, PTP offloads timestamp processing to hardware, reducing CPU and network overhead while improving accuracy:

Feature

PTP

NTP

Accuracy

Sub-microsecond

Millisecond

Timestamp implementation

Hardware support (such as PHC devices)

Software implementation

Network environment

Local area network or low-latency

Wide area network

Resource consumption

Low (controllable message frequency)

High (relies on frequent message exchanges)

Typical application

Financial trading

Internet servers, general devices

Alibaba Cloud deploys redundant active-standby atomic clocks per zone. The primary clock synchronizes with GPS and builds a hierarchical topology using IEEE 1588 boundary clocks to deliver sub-microsecond time signals to ECS instances.

By default, ECS instances use Chrony or NTP for time synchronization. You can enable PTP on supported regions and instance types for sub-microsecond accuracy.

Use cases

High-frequency financial trading: PTP hardware timestamps align order timing across exchanges at sub-microsecond precision, preventing disputes from clock drift and meeting timing fairness and compliance requirements.

Limitations

Enable or disable PTP for an ECS instance

Enable the PTP time synchronization service

  1. Enable PTP in the console

    • Create an instance

      Go to the Custom Launch tab in the ECS console. Select a PTP-supported region, instance type, and image. In the Advanced Options section, enable PTP.

    • For an existing instance

      If the physical server does not support PTP, restart the instance to migrate it to a supported server before enabling PTP.
      1. Go to the and click the ID of the target instance to go to the instance details page.

      2. On the Instance Details page, from the All Operations drop-down list, choose Instance Settings > Set PTP Time Synchronization Service.

      3. In the Set PTP Time Synchronization Service dialog box, enable PTP.

        After you click OK, the PTP Time Synchronization Task window appears.

      4. Click the task ID to view progress. After the task completes, PTP is enabled for the instance.

  2. Remotely connect to the Linux instance.

  3. Cloud Assistant is pre-installed on public images.

    Public commands and plugin features require Cloud Assistant.

    Cloud Assistant common commands

    1. Go to the ECS console - Cloud Assistant page and switch to the Common Commands tab.

    2. Find the ACS-ECS-EnablePTP-for-linux.sh command and click Run in the Actions column.

    3. Select the running instance and click Run.

    Cloud Assistant plugin

    1. Check whether the PHC hardware device exists.

      If the PHC hardware device does not exist, submit a ticket.
      lspci | grep 500c

      If PTP is enabled, the command returns:

      image

    2. Check the Cloud Assistant version. Version 2.2.3.631 or later is required. If earlier, upgrade Cloud Assistant.

      acs-plugin-manager --version
    3. Confirm the Cloud Assistant plugin is available in the current region.

      If the plugin is not available, submit a ticket.
      acs-plugin-manager --list | grep ACS-PTP-Monitor
    4. Install the driver with Cloud Assistant.

      Typically completes within 10 minutes.
      acs-plugin-manager --exec --plugin ACS-PTP-Monitor --params --install --timeout 0
    5. Start the ptp-monitor service.

      Updates chrony configuration, restarts chronyd, enables ptp-monitor auto-start, and starts ptp-monitor.
      acs-plugin-manager --exec --plugin ACS-PTP-Monitor --params --start

    Installation package

    1. Check for the PHC hardware device.

      lspci | grep 500c

      If PTP is enabled, the command returns:

      image

    2. Download the compressed script package. An Internet connection is required.

      After enabling PTP, use the ptp-monitor script for one-click deployment and configuration.
      wget https://ptp-monitor-hk.oss-cn-hongkong.aliyuncs.com/ptp-monitor/ptp-monitor-latest.zip
    3. Decompress the package.

      yum install -y unzip
      unzip ptp-monitor-latest.zip -d ptp-monitor-latest
      cd ptp-monitor-latest
      On operating systems such as Ubuntu and Debian, run sudo apt update && sudo apt install unzip to install unzip.
    4. Compile and install the driver.

      bash ptp-monitor.sh --install
    5. Confirm the PTP driver is installed.

      ptp-monitor compiles the PTP driver based on the current operating system. The driver is named ptp_cipu.
      lsmod | grep ptp_cipu
    6. Confirm the PTP device file is generated.

      ll /dev/ptp*

      If device file information is returned, the driver is running correctly.

      image

    7. Configure chrony, restart chronyd, and start ptp-monitor.

      bash ptp-monitor.sh --start

      The PTP clock source takes effect within tens of seconds. Verify by viewing the PTP synchronization status.

Disable the PTP time synchronization service

  1. Disable PTP in the console

    1. Go to the and click the ID of the target instance to go to the instance details page.

    2. On the Instance Details page, from the All Operations drop-down list, choose Instance Settings > Set PTP Time Synchronization Service.

    3. In the Set PTP Time Synchronization Service dialog box, disable PTP.

      After you click OK, the PTP Time Synchronization Task window appears.

    4. Click the task ID to view progress. After the task completes, PTP is disabled for the instance.

  2. Remotely connect to the Linux instance.

  3. Cloud Assistant is pre-installed on public images.

    Public commands and plugin features require Cloud Assistant.

    Cloud Assistant common commands

    1. Go to the ECS console - Cloud Assistant page and switch to the Common Commands tab.

    2. Find the ACS-ECS-DisablePTP-for-linux.sh command and click Run in the Actions column.

    3. Select the running instance and click Run.

    Cloud Assistant plugin

    Stop the ptp-monitor service.

    Disabling PTP removes the PTP device, updates chrony to remove the PTP hardware clock source, restarts chronyd to restore default clock services such as NTP, and stops ptp-monitor.
    acs-plugin-manager --exec --plugin ACS-PTP-Monitor --params --stop

    Installation package

    Disable the PTP clock source.

    Disabling PTP removes the PTP device, updates chrony to remove the PTP hardware clock source, restarts chronyd to restore default clock services such as NTP, and stops ptp-monitor.
    bash ptp-monitor.sh --stop

View PTP synchronization status

Run chronyc sources to view configured time sources (PTP and NTP).

Sample output:

The following example shows an instance using the PTP hardware clock as its primary synchronization source at nanosecond-level accuracy:

image

  • MS: Time source identifier. PHC0 indicates the PTP hardware clock; an IP address indicates an NTP server.

    #* marks the active synchronization source. In this example, the instance uses the PTP hardware clock.

  • Stratum: Stratum level. Lower values indicate higher accuracy (0 = atomic clock or GPS, 1 = directly connected high-precision source).

  • Poll: Polling interval exponent. Interval = 2^Poll seconds. For example, Poll=4 = 16 seconds.

  • Reach: Octal value indicating the success rate of the last eight synchronization attempts.

  • LastRx: Seconds since the last response was received.

  • Last sample: The clock offset from the last measurement, in the format offset [raw offset] +/- error, reflecting the difference between system time and source time.

Monitor PTP synchronization health

Run chronyc tracking to view system clock health metrics, including time bias, frequency error, and network latency.

Sample output:

In this example, the time bias is at the nanosecond level (System time = 1 ns, RMS offset = 1,175 ns) and the frequency error is low (5.213 ppm), indicating stable hardware clock operation:

image

  • System time: Bias between the system clock and PTP hardware clock PHC0slow means the system time is 1 nanosecond behind (1 ns = 10⁻⁹ s).

  • RMS offset: Long-term root mean square offset (1,175 ns in this example), reflecting synchronization stability.

  • Frequency: System clock frequency bias. slow means the local clock runs 5.213 µs/s slower than PHC0 (ppm = parts per million).

  • Root delay: Total network latency to the root time source. Low latency indicates a stable network environment.

FAQ

Can I enable or disable the PTP time synchronization service using OpenAPI?

  1. You can enable or disable PTP via OpenAPI.

    • Create an instance: Call RunInstances and set PtpStatus in ClockOptions to enabled or disabled.

    • For an existing instance: Call ModifyInstanceClockOptions and set PtpStatus to enabled or disabled.

      On success, a task ID (TaskId) is returned. Call DescribeTasks with TaskAction set to ModifyInstanceClockOptions and TaskIds set to the task ID to query task status.

  2. Call DescribeInstances with AdditionalAttributes set to CLOCK_OPTIONS to verify PTP status.

  3. Call RunCommand to run the relevant commands to complete configuration.

Can PTP be used with NTP?

Yes. PTP does not affect NTP. chronyd uses an internal algorithm to select the best clock source and prioritizes PTP based on the configuration.

When I install the driver, the "dkms: command not found" error is reported.

PTP driver installation first installs required tool packages including dkms. Resolve the dkms package installation issue. For detailed error logs, see /var/log/ptp-cipu-ptp-monitor.log.

How do I enable or disable auto-start for the ptp-monitor program?

ptp-monitor is an O&M component running on the instance. Keeping it running is recommended but not mandatory. By default, it starts automatically on boot.

  • Disable auto-start on boot.

    acs-plugin-manager --exec --plugin ACS-PTP-Monitor --params --disable-service
  • Enable auto-start on boot.

    acs-plugin-manager --exec --plugin ACS-PTP-Monitor --params --enable-service

How do I uninstall the PTP driver?

The PTP driver (ptp_cipu) is required for PTP and does not affect the instance. To uninstall it, run the following Cloud Assistant command:

acs-plugin-manager --exec --plugin ACS-PTP-Monitor --params --uninstall