Topic
No replies
GrantRobbennolt
GrantRobbennolt
1 Post
ACCEPTED ANSWER

Pinned topic improving localtime_r scalability

‏2013-06-13T20:03:55Z |

localtime_r is serialized, and scales very poorly (  AIX 7.1) Is there an alternative that performs better? Is there any tuning that can be done? I have attempted tuning with SPINLOOPTIME/YIELDLOOPTIME/AIXTHREAD_SCOPE etc variables, but these seem to have no obvious effect in this case.  I see similar behavior using a POSIX TZ rather than Olson.  Concurrency scales from 2.2 million calls/sec with 1 thread, down to 80 thousand calls/sec with 32 threads on a 32 (logical)core Power7

Here is a typical set of stack traces:

---------- tid# 57016489 (pthread ID:   3085) ----------
0xd04fd52c  _global_lock_common(??, ??, ??) + 0x26c
0xd01139f0  _rec_mutex_lock(??) + 0x150
0xd01dcf84  localtime64_tz_r(??, ??, ??) + 0x4e4
0xd0218620  localtime_r(??, ??) + 0x20
0x100005f0  test() + 0x90
0xd04fed04  _pthread_body(??) + 0xe4
---------- tid# 24314089 (pthread ID:   2828) ----------
0xd01138e0  _rec_mutex_lock(??) + 0x40
0xd01131bc  getenv(??) + 0x17c
0xd01dfe9c  olson_tzset() + 0x1c
0xd01dfde0  olson_localtime(0x0, 0x51b9e499, 0x20157a78) + 0x20
0xd01dca40  localtime64_tz_ost_r(??, ??) + 0x20
0xd01dcedc  localtime64_tz_r(??, ??, ??) + 0x43c
0xd0218620  localtime_r(??, ??) + 0x20
0x100005f0  test() + 0x90
0xd04fed04  _pthread_body(??) + 0xe4
---------- tid# 42205281 (pthread ID:   2571) ----------
0xd04fc4d8  _global_unlock_common(??, ??) + 0x58
0xd011384c  _rec_mutex_unlock(??) + 0x8c
0xd01dcf58  localtime64_tz_r(??, ??, ??) + 0x4b8
0xd0218620  localtime_r(??, ??) + 0x20
0x100005f0  test() + 0x90
0xd04fed04  _pthread_body(??) + 0xe4
---------- tid# 20054195 (pthread ID:   2314) ----------
0xd04fd504  _global_lock_common(??, ??, ??) + 0x244
0xd01139f0  _rec_mutex_lock(??) + 0x150
0xd01dcf84  localtime64_tz_r(??, ??, ??) + 0x4e4
0xd0218620  localtime_r(??, ??) + 0x20
0x100005f0  test() + 0x90
0xd04fed04  _pthread_body(??) + 0xe4
---------- tid# 57999421 (pthread ID:   2057) ----------
0xd04fd514  _global_lock_common(??, ??, ??) + 0x254
0xd01139f0  _rec_mutex_lock(??) + 0x150
0xd01dcf84  localtime64_tz_r(??, ??, ??) + 0x4e4
0xd0218620  localtime_r(??, ??) + 0x20
0x100005f0  test() + 0x90
0xd04fed04  _pthread_body(??) + 0xe4
 

IV18185 is applied on my test system

Attached example program.

to compile: xlc_r testlocaltime.c -lpthread -otest

to test localtime_r function: ./test     

to test gmtime_r function: ./test gmtime

to test framework scalability : ./test null

 

Attachments

Updated on 2013-06-14T17:28:25Z at 2013-06-14T17:28:25Z by GrantRobbennolt
  • This reply was deleted by GrantRobbennolt 2013-06-13T20:20:12Z.