MINOR: lb/map: use seek lock and read locks where appropriate
authorWilly Tarreau <w@1wt.eu>
Sat, 17 Oct 2020 16:55:18 +0000 (18:55 +0200)
committerWilly Tarreau <w@1wt.eu>
Sat, 17 Oct 2020 17:04:27 +0000 (19:04 +0200)
commitae99aeb135ac18b1442ddf9eeccb16cb35d2d04d
tree44b5dd5bdef7c8f601ee6ec54ed4220dc6568269
parentcd10def825119900cfd5d87f6a48e5282679e95a
MINOR: lb/map: use seek lock and read locks where appropriate

- map_get_server_hash() doesn't need a write lock since it only
  reads the array, let's only use a read lock here.

- map_get_server_rr() only needs exclusivity to adjust the rr_idx
  while looking for its entry. Since this one is not used by
  map_get_server_hash(), let's turn this lock to a seek lock that
  doesn't block reads.

With 8 threads, no significant performance difference was noticed
given that lookups are usually instant with this LB algo so the
lock contention is rare.
src/lb_map.c