The Precision Time Protocol (PTP) uses hardware-level timestamps and dynamic path compensation to achieve sub-microsecond clock synchronization. This ensures timing consistency in distributed systems and is ideal for scenarios that demand high time accuracy, such as high-frequency financial trading.
What is PTP
The PTP time synchronization feature is currently in private 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. It 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 like Network Time Protocol (NTP). This bottleneck is primarily caused by software processing latency and network jitter. PTP provides a sub-microsecond time synchronization service 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 PTP hardware clock devices) |
Software implementation |
|
Network environment |
LAN or low-latency network |
WAN |
|
Resource consumption |
Low (controllable packet exchange frequency) |
High (relies on frequent packet switching) |
|
Typical application |
Financial trading |
Internet servers, general-purpose devices |
The Alibaba Cloud PTP synchronization architecture deploys redundant active-standby atomic clocks at the zone level. After synchronizing with GPS time, the primary atomic clock builds a hierarchical time synchronization topology by using the IEEE 1588 PTP boundary clock protocol to progressively deliver sub-microsecond time signals to ECS instances.
By default, an ECS instance runs the chrony or NTP service for time synchronization. You can enable the PTP time synchronization service on instances in supported regions and of supported instance types to achieve high-precision time synchronization.
Use cases
High-frequency financial trading: The sub-microsecond synchronization accuracy and hardware timestamps of PTP ensure strict alignment of order timing across exchanges, which 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.
Limitations
-
Supported regions and zones:
Region name
Region ID
Zone name
Zone ID
China (Hong Kong)
cn-hongkong
Zone B (private preview)
cn-hongkong-b
Zone C (private preview)
cn-hongkong-c
Zone D (private preview)
cn-hongkong-d
-
Supported instance families:
To check if an instance type supports PTP, call the DescribeInstanceTypes operation. If the PtpSupport parameter in the Clock object of the response is set to supported, the instance type supports PTP. If the instance type does not support PTP, the PtpSupport parameter is not returned.
-
General-purpose instance family g9i, compute-optimized instance family c9i, and memory-optimized instance family r9i (private preview)
-
General-purpose ECS Bare Metal Instance families ebmg9i, ebmc9i, and ebmr9i (private preview)
-
High-clock speed compute-optimized instance family hfc9i, high-clock speed general-purpose instance family hfg9i, and high-clock speed memory-optimized instance family hfr9i
-
-
Supported images: Linux images are supported. We recommend using officially maintained images.
-
The Linux kernel version must be 4.12 or later.
Enable or disable PTP
Enable the PTP service
-
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, and then in the Advanced Options section, enable the PTP time synchronization service.
-
For an existing instance
If an instance's host physical server does not support PTP, you must restart the instance. The restart migrates the instance to a supported server, enabling the PTP time synchronization service.
-
Go to the Instances page in the ECS console and click the ID of the target instance to go to the instance details page.
-
On the Instance Details page, choose from the All Operations drop-down list.
-
In the Configure PTP Clock Synchronization Service dialog box, enable the PTP time synchronization service.
After you click OK, the PTP Time Synchronization Task window appears.
-
Click the task ID to view the task progress. After the task is complete, the window automatically closes, and the PTP time synchronization service is enabled for the instance.
-
-
-
For instances created from non-public images, you must install Cloud Assistant manually from an installation package.
Cloud Assistant is required to use common command and plugin features.
Cloud assistant common commands
-
Go to the Cloud Assistant page in the ECS console and click the Common Commands tab.
-
Find the
ACS-ECS-EnablePTP-for-linux.shcommand and click Run in the Actions column. -
Select the running instance and click Run.
Cloud assistant plugin
-
Check whether the PTP hardware clock device exists.
If the PTP hardware clock device does not exist, submit a ticket.
lspci | grep 500cIf the PTP time synchronization service is enabled, the command returns the following information:

-
Run the Cloud Assistant command to check its version. The version must be
2.2.3.631or later. If the version does not meet the requirement, upgrade Cloud Assistant.acs-plugin-manager --version -
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 -
Install the driver by using Cloud Assistant.
The command typically completes within 10 minutes.
acs-plugin-manager --exec --plugin ACS-PTP-Monitor --params --install --timeout 0 -
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
-
Run the following command to check for the PTP hardware clock device:
lspci | grep 500cIf the PTP time synchronization service is enabled, the command returns the following information:

-
Run the following command to obtain the compressed script package. A public IP address is required.
After you enable PTP for an ECS instance, you can use the
ptp-monitorscript for one-click deployment and configuration.wget https://ptp-monitor-hk.oss-cn-hongkong.aliyuncs.com/ptp-monitor/ptp-monitor-latest.zip -
Run the following commands to decompress the package:
yum install -y unzip unzip ptp-monitor-latest.zip -d ptp-monitor-latest cd ptp-monitor-latestOn operating systems such as Ubuntu and Debian, you can run the
sudo apt update && sudo apt install unzipcommand to installunzip. -
Run the following command to compile and install the driver:
bash ptp-monitor.sh --install -
Run the following command to confirm that the PTP driver is installed:
ptp-monitorcompiles the PTP driver based on the current operating system version. The driver is namedptp_cipu.lsmod | grep ptp_cipu -
Run the following command to check whether the PTP device file is created:
ll /dev/ptp*If information about the device file is returned, the driver is running as expected:

-
Run the following command to configure chrony, restart the chronyd service, and run the ptp-monitor service:
bash ptp-monitor.sh --startAfter the chronyd service is restarted, the PTP clock source takes effect within seconds. You can view the PTP time synchronization service for the instance to confirm the result.
-
Disable the PTP service
-
Disable PTP in the console
-
Go to the Instances page in the ECS console and click the ID of the target instance to go to the instance details page.
-
On the Instance Details page, choose from the All Operations drop-down list.
-
In the Configure PTP Clock Synchronization Service dialog box, disable the PTP time synchronization service.
After you click OK, the PTP Time Synchronization Task window appears.
-
Click the task ID to view the task progress. After the task is complete, the window automatically closes, and the PTP time synchronization service is disabled for the instance.
-
-
For instances created from non-public images, you must install Cloud Assistant manually from an installation package.
Cloud Assistant is required to use common command and plugin features.
Cloud assistant common commands
-
Go to the Cloud Assistant page in the ECS console and click the Common Commands tab.
-
Find the
ACS-ECS-DisablePTP-for-linux.shcommand and click Run in the Actions column. -
Select the running instance and click Run.
Cloud assistant plugin
Run the following command to stop the ptp-monitor service.
This command removes the PTP device, 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 --stopInstallation package
Disable the PTP clock source.
This command removes the PTP device, 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 service
Run the chronyc sources command to view the status of the configured time sources, such as PTP and NTP.
Sample output:
The following figure shows the output for 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:

-
MS: The time source identifier.PHC0indicates a PTP hardware clock. An IP address indicates an NTP server.#*indicates the current synchronization source. In this example, the instance is using the PTP hardware clock for synchronization. -
Stratum: The stratum of the time source. A smaller value indicates higher accuracy. For example, 0 indicates an atomic clock or GPS, and 1 indicates a directly connected high-precision source. -
Poll: The polling interval as a power of 2 in seconds. The current polling interval is2^Pollseconds. For example,Poll=4indicates 16 seconds. -
Reach: An octal value that indicates the success rate of the last eight synchronization attempts. -
LastRx: The time in seconds since the last response was received. -
Last sample: The clock offset from the last measurement, in the formatoffset [raw offset] +/- error. This value reflects the difference between the system time and the source time.
Monitor PTP health
Run the chronyc tracking command to monitor and evaluate the health of the system clock. The command provides dynamic metrics such as time offset, 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 offset 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 PTP hardware clock stability:

-
System time: The current offset between the system clock and the PTP hardware clockPHC0.slowindicates that the system time is 1 nanosecond (1 ns = 10⁻⁹ s) slower. -
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 offset of the system clock.slowindicates that the local clock is 5.213 microseconds slower per second than the PTP hardware clockPHC0(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
Enable or disable PTP by API
-
Enable or disable the PTP time synchronization service.
-
To create an instance: Call the RunInstances operation 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 the ModifyInstanceClockOptions operation 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 is returned. You can call the DescribeTasks operation, set TaskAction to ModifyInstanceClockOptions, and set TaskIds to the task ID to query the task's real-time execution status.
-
-
Call the DescribeInstances operation and set AdditionalAttributes to CLOCK_OPTIONS to check whether the PTP time synchronization service is enabled for the instance.
-
Call the RunCommand operation to run the related commands to complete the configuration.
Can PTP be used with NTP?
Yes. 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.
Dkms: command not found error
This error indicates that the dkms package failed to install. You must resolve this issue before proceeding. For detailed error logs about the driver installation failure, check the /var/log/ptp-cipu-ptp-monitor.log file.
-
Scenario 1: The repository source configuration may not be up to date. You can update the repository source and try again.
-
Scenario 2: Go to the official dkms website to obtain the corresponding installation package.
Enable or disable auto-start for ptp-monitor
ptp-monitor is an operations and maintenance (O&M) component that runs on the instance. Keeping it running is recommended for operational stability, 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
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