Cache calls to Process.pid

Cache calls to Process.pid to avoid lots of useless system calls on modern Linux.Ruby's Process.pid calls the standard libc getpid(2), historically pretty much all implementations of the libc have been caching this function to avoid doing a syscall everytime.However glibc 2.25 released in 2017 removed that cache, causing a performance regression for application frequently monitoring the PID.
Cache calls to Process.pid #ruby #rubydeveloper #rubyonrails https://rubyonrails.ba/single/cache-calls-to-process-pid

Nezir Zahirovic

Contractor Ruby On Rails (8+ years) / MCPD .Net / C# / Asp.Net / CSS / SQL / (11 years)

related articles