All Products
Search
Document Center

Elastic Compute Service:PTP time synchronization service

Last Updated:Dec 19, 2025

Precision Time Protocol (PTP) uses hardware-level timestamps and dynamic path compensation to achieve sub-microsecond clock synchronization. This feature ensures timing consistency in distributed systems and is ideal for scenarios that require strict time accuracy, 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 network time synchronization protocol based on the IEEE 1588 standard. PTP uses technologies such as hardware-level timestamps, dynamic path compensation, and intelligent master-slave clock negotiation to overcome the millisecond-level error bottleneck of traditional network time protocols, such as Network Time Protocol (NTP). This bottleneck is primarily caused by software processing latency and network jitter. PTP provides sub-microsecond time synchronization for devices in distributed systems.

Compared to NTP, PTP offloads calculations using hardware timestamps. This reduces CPU and network resource consumption while achieving higher 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 exchange frequency)

High (relies on frequent message switching)

Typical application

Financial trading

Internet servers, general devices

The Alibaba Cloud PTP synchronization architecture uses a redundant deployment of active and standby atomic clocks at the zone level. The primary atomic clock synchronizes with GPS time and then builds a hierarchical synchronization topology using the IEEE 1588 PTP boundary clock protocol to deliver sub-microsecond time signals to ECS instances.

By default, ECS instances run the Chrony or NTP service for time synchronization. You can enable the PTP time synchronization service on supported regions and instance types to achieve high-precision time synchronization.

Scenarios

High-frequency financial trading: The sub-microsecond synchronization accuracy and hardware timestamps of PTP ensure strict alignment of order timing across exchanges. This avoids disputes over transaction order caused by clock drift. When combined with sub-microsecond jitter control on low-latency networks, PTP meets the strict requirements of high-frequency trading for timing fairness and compliance.

Limits

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 region, instance type, and image that support PTP. Then, in the Advanced Settings (Optional) section, enable the PTP time synchronization service.

    • For an existing instance

      If the physical server where the instance is located does not support PTP, you must restart the instance to migrate it to a supported physical server before you can enable 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 More drop-down list, choose Instance Settings > Set PTP Time Synchronization Service.

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

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

      4. Click the task ID to view the task progress. After the task is complete, the dialog box automatically closes, and the PTP time synchronization service is enabled for the instance.

  2. Remotely connect to the Linux instance.

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

    Using public commands and plugin features requires Cloud Assistant.

    Cloud Assistant public commands

    1. Go to the Cloud Assistant page in the ECS console and switch to the Public Commands tab.

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

    3. Select the running instance and click Execute.

    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 the PTP time synchronization service is enabled, the command returns the following information:

      image

    2. Run the Cloud Assistant command to check its version. The version must be 2.2.3.631 or later. If the version is earlier, upgrade Cloud Assistant.

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

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

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

      This command updates the chrony configuration, restarts chronyd, enables ptp-monitor to start on boot, and starts the ptp-monitor service.
      acs-plugin-manager --exec --plugin ACS-PTP-Monitor --params --start

    Installation package

    1. Run the following command to check for the PHC hardware device.

      lspci | grep 500c

      If the PTP time synchronization service is enabled, the command returns the following information:

      image

    2. Run the following command to obtain the compressed script package. An Internet connection is required.

      After you enable PTP for an ECS instance, you can 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. Run the following commands to 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, you can run the sudo apt update && sudo apt install unzip command to install unzip.
    4. Run the following command to compile and install the driver.

      bash ptp-monitor.sh --install
    5. Run the following command to confirm that 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. Run the following command to confirm that the PTP device file is generated.

      ll /dev/ptp*

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

      image

    7. Run the following command to configure chrony, restart the chronyd service, and run the ptp-monitor service.

      bash ptp-monitor.sh --start

      After the chronyd service is restarted, the PTP clock source takes effect within tens of seconds. You can verify this by viewing the PTP time synchronization service for the instance.

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 More drop-down list, choose Instance Settings > Set PTP Time Synchronization Service.

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

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

    4. Click the task ID to view the task progress. After the task is complete, the dialog box automatically closes, and the PTP time synchronization service is disabled for the instance.

  2. Remotely connect to the Linux instance.

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

    Using public commands and plugin features requires Cloud Assistant.

    Cloud Assistant public commands

    1. Go to the Cloud Assistant page in the ECS console and switch to the Public Commands tab.

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

    3. Select the running instance and click Execute.

    Cloud Assistant plugin

    Run the following command to stop the ptp-monitor service.

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

    Installation package

    Disable the PTP clock source.

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

View the PTP time synchronization service for an instance

Run the chronyc sources command to view the status of configured time sources (PTP and NTP).

Sample output:

The following figure shows an example of an instance for which the PTP time synchronization service is enabled and configured. The instance is prioritizing the PTP hardware clock for synchronization and achieving nanosecond-level accuracy:

image

  • MS: The time source identifier. PHC0 indicates the PTP hardware clock, and an IP address indicates an NTP server.

    #* indicates the current synchronization source, which means the instance is using the PTP hardware clock for synchronization.

  • Stratum: The stratum level of the time source. A smaller value indicates higher accuracy (0 for an atomic clock or GPS, 1 for a directly connected high-precision source).

  • Poll: The polling interval exponent. The current polling interval is 2^Poll seconds. For example, Poll=4 means 16 seconds.

  • Reach: An octal value that indicates the success rate of the last eight synchronization attempts.

  • LastRx: The time since the last response was received, in seconds.

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

Monitor PTP time synchronization health

Run the chronyc tracking command to monitor and evaluate the health of the system clock. The command provides dynamic metrics such as time bias, frequency error, and network latency, which help ensure the reliability of time-sensitive applications such as financial trading.

Sample output:

As shown in the following figure, the time bias is at the nanosecond level (System time = 1 ns, RMS offset = 1,175 ns), which meets the requirements of high-precision scenarios. The frequency error is low (5.213 ppm), which indicates good hardware clock stability:

image

  • System time: The current bias between the system clock and the PTP hardware clock PHC0slow indicates that the system time is 1 nanosecond slower (1 nanosecond = 10⁻⁹ seconds).

  • RMS offset: The long-term root mean square offset, which is 1,175 nanoseconds in this example. This reflects the stability of the time synchronization.

  • Frequency: The frequency bias of the system clock. slow indicates that the local clock is 5.213 microseconds slower per second than the PTP hardware clock PHC0 (ppm = parts per million).

  • Root delay: The total network latency to the root time source. The extremely low latency shown in the figure indicates a highly stable network environment.

FAQ

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

  1. You can enable or disable the PTP time synchronization service.

    • Create an instance: Call RunInstances and set the PtpStatus parameter in ClockOptions to enabled or disabled to create an ECS instance with the PTP time synchronization service enabled or disabled.

    • For an existing instance: Call ModifyInstanceClockOptions and set PtpStatus to enabled or disabled to enable or disable the PTP time synchronization service for the instance.

      If the call is successful, a task ID (TaskId) is returned. You can call DescribeTasks, set TaskAction to ModifyInstanceClockOptions, and set TaskIds to the corresponding task ID, to query the real-time execution status of the task.

  2. Call DescribeInstances and set AdditionalAttributes to CLOCK_OPTIONS to confirm whether the PTP time synchronization service is enabled for the instance.

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

Can PTP be used with NTP?

Yes, it can. PTP does not affect NTP. chronyd uses an internal algorithm to select the best clock source. Based on the configuration, it prioritizes PTP as the clock source.

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

When you install the PTP driver, required tool packages are installed first. The dkms tool is one of these dependencies. You must resolve the dkms package installation issue. For detailed error logs about the driver installation failure, 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 operations and maintenance (O&M) component that runs on the instance. We recommend keeping it running, but it is not mandatory. By default, this component is configured to start 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 is named ptp_cipu. This driver is required for the PTP feature and its installation does not affect the instance. To uninstall the PTP driver, run the following Cloud Assistant command:

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