i've heard system.nanotime()
not consistent across cpu cores in java + linux. how can measure latency of one-way message on loopback, in other words, in same machine. flow is:
- client sends message server timestamp in it
- server gets message
- servers parses timestamp out of message
- servers calculates one-way latency (now - timestamp)
note server , client running in same machine pinned different cpu cores.
you can use system.nanotime(). it's problem on old oses such multi-socket machines running windows xp.
within machine.
- write timestamp in 1 thread
- read timestamp in thread.
note: measuring latency way has serious problems such co-ordinated omission. better approach is
- calculate when test should start based on target throughput want measure.
- busy wait time reached if not behind.
- write time message should have been sent rather time sent.
- read timestamp , compare.
- record distribution.
you can use system.nanotime() between machines doing round trip test
- send timestamp
- have other end send back.
- compare current time.
Comments
Post a Comment