ua_ has quit [Read error: Connection reset by peer]
<MilkMann>
hellloo
ua_ has joined #ruby
<MilkMann>
has anyone optimized Ruby apps with FFI-based C extensions in high-concurrency environments using `concurrent-ruby`? I’m dealing with severe GIL contention and thread switching, despite using `pthread` in C extensions and tweaking Ruby’s thread scheduler with `Thread.pass` and priority adjustments. Latency spikes occur due to CPU contention
<MilkMann>
when Ruby threads block on native I/O, though the workload is mostly I/O-bound. Even with `GC::Profiler` and `GC.start`, GC pauses persist, likely due to fragmentation in memory under heavy concurrency. Any strategies to reduce GC overhead without resorting to a process-based model?
<MilkMann>
Also, using `Thread.current` for thread-local storage causes race conditions when native threads modify shared memory. `Concurrent::Map` introduces excessive locking, which worsens contention. Is there a more efficient pattern for managing thread-local state in a hybrid Ruby/C environment without excessive synchronization?
<MilkMann>
Finally, `ruby-prof` and `stackprof` profiles are too noisy to pinpoint latency sources. Are there advanced tracing or custom instrumentation tools that can isolate Ruby-native interaction bottlenecks in high-concurrency, multi-language setups?
ua_ has quit [Read error: Connection reset by peer]
ua_ has joined #ruby
hwpplayer1 has quit [Remote host closed the connection]
<mange>
I don't know the answers to anything you're asking, but out of interest: have you tried using jemalloc? I switched to using it a while back and it's performed better for us in production. That said, we're not high-concurrency, so it might not be applicable.
<kinduff>
sounds like a garbage problem, have you tweaked "RUBY_GC_HEAP_INIT_SLOTS", "RUBY_GC_HEAP_FREE_SLOTS" and "RUBY_GC_HEAP_GROWTH_FACTOR"?
<MilkMann>
yeah, I’ve tweaked those but the GC pauses are still frequent, especially with heavy concurrency. any other GC tuning tips, or should I look into a different approach to handle this mix of threads and C extensions?
<kinduff>
in my opinion, if you're on that level of tweaking because your system still needs higher concurrency, you're better off with a language that can do, e.g fibers
<kinduff>
you will be patching and tweaking, or try scale in another direction
cappy has quit [Quit: Leaving]
hwpplayer1 has joined #ruby
hwpplayer1 has quit [Remote host closed the connection]
jhass has quit [Remote host closed the connection]
jhass has joined #ruby
brokkoli_origin has quit [Ping timeout: 276 seconds]
brokkoli_origin has joined #ruby
Linux_Kerio has quit [Ping timeout: 252 seconds]
Linux_Kerio has joined #ruby
lunarkitty has quit [Read error: Connection reset by peer]
donofrio_ has joined #ruby
hwpplayer1 has joined #ruby
MilkMann has quit [Quit: Client closed]
hwpplayer1 has quit [Remote host closed the connection]
kludger has quit [Ping timeout: 276 seconds]
kludger has joined #ruby
Sampersand has joined #ruby
Tempesta has quit [Read error: Connection reset by peer]
Tempesta has joined #ruby
Tempesta has quit [Changing host]
Tempesta has joined #ruby
Tempesta has quit [Read error: Connection reset by peer]
Tempesta has joined #ruby
Tempesta has quit [Changing host]
Tempesta has joined #ruby
Tempesta has quit [Excess Flood]
Tempesta has joined #ruby
Tempesta has quit [Changing host]
Tempesta has joined #ruby
Tempesta has quit [Excess Flood]
Tempesta has joined #ruby
Tempesta has quit [Changing host]
Tempesta has joined #ruby
Tempesta has quit [Excess Flood]
Tempesta has joined #ruby
Tempesta has quit [Changing host]
Tempesta has joined #ruby
Tempesta has quit [Excess Flood]
Tempesta has joined #ruby
Tempesta has quit [Changing host]
Tempesta has joined #ruby
Tempesta has quit [Excess Flood]
Tempesta has joined #ruby
Tempesta has quit [Changing host]
Tempesta has joined #ruby
Tempesta has quit [Excess Flood]
donofrio_ has quit [Ping timeout: 255 seconds]
mange has quit [Remote host closed the connection]
grenierm has joined #ruby
Sampersand has quit [Ping timeout: 256 seconds]
chen has quit [Quit: No Ping reply in 180 seconds.]
chen has joined #ruby
Perflosopher2 has joined #ruby
Perflosopher has quit [Ping timeout: 260 seconds]
Perflosopher2 is now known as Perflosopher
kludger has quit [Ping timeout: 244 seconds]
kludger has joined #ruby
grenierm has quit [Ping timeout: 256 seconds]
brokkoli_origin has quit [Ping timeout: 252 seconds]
brokkoli_origin has joined #ruby
Tempesta has joined #ruby
Tempesta has quit [Changing host]
Tempesta has joined #ruby
Tempesta has quit [Excess Flood]
Tempesta has joined #ruby
Tempesta has quit [Changing host]
Tempesta has joined #ruby
Tempesta has quit [Excess Flood]
Tempesta has joined #ruby
Tempesta has quit [Changing host]
Tempesta has joined #ruby
Tempesta has quit [Excess Flood]
Tempesta has joined #ruby
Tempesta has quit [Changing host]
Tempesta has joined #ruby
Tempesta has quit [Excess Flood]
Tempesta has joined #ruby
Tempesta has quit [Changing host]
Tempesta has joined #ruby
Tempesta has quit [Excess Flood]
Tempesta has joined #ruby
Tempesta has quit [Changing host]
Tempesta has joined #ruby
Tempesta has quit [Excess Flood]
hwpplayer1 has joined #ruby
hwpplayer1 has quit [Remote host closed the connection]
kludger has quit [Ping timeout: 265 seconds]
tuxcrafter78 has quit [Quit: Client closed]
tuxcrafter78 has joined #ruby
kludger has joined #ruby
tuxcrafter78 has quit [Quit: Client closed]
tuxcrafter78 has joined #ruby
kludger has quit [Ping timeout: 260 seconds]
kludger has joined #ruby
kludger_ has joined #ruby
kludger has quit [Read error: Connection reset by peer]
kludger has joined #ruby
kludger_ has quit [Ping timeout: 255 seconds]
kludger_ has joined #ruby
kludger has quit [Ping timeout: 276 seconds]
dviola has quit [Read error: Connection reset by peer]
kludger has joined #ruby
kludger_ has quit [Ping timeout: 276 seconds]
kludger_ has joined #ruby
kludger has quit [Ping timeout: 248 seconds]
kludger has joined #ruby
kludger_ has quit [Ping timeout: 244 seconds]
kludger has quit [Ping timeout: 252 seconds]
kludger has joined #ruby
kludger has quit [Ping timeout: 260 seconds]
donofrio_ has joined #ruby
kludger has joined #ruby
kludger has quit [Ping timeout: 260 seconds]
kludger has joined #ruby
kludger has quit [Ping timeout: 252 seconds]
kludger has joined #ruby
donofrio_ has quit [Ping timeout: 265 seconds]
balo has quit [Quit: leaving]
balo has joined #ruby
kludger has quit [Ping timeout: 252 seconds]
kludger_ has joined #ruby
kludger__ has joined #ruby
kludger_ has quit [Ping timeout: 260 seconds]
OverCoder is now known as OdinYggd
OdinYggd is now known as UnderCoder
UnderCoder is now known as linux_probe
linux_probe is now known as kmem
kmem is now known as OverCoder
donofrio_ has joined #ruby
Tempesta has joined #ruby
Tempesta has quit [Changing host]
Tempesta has joined #ruby
Tempesta has quit [Excess Flood]
Tempesta has joined #ruby
Tempesta has quit [Changing host]
Tempesta has joined #ruby
Tempesta has quit [Excess Flood]
Tempesta has joined #ruby
Tempesta has quit [Changing host]
Tempesta has joined #ruby
Tempesta has quit [Excess Flood]
dviola has joined #ruby
Tempesta has joined #ruby
Tempesta has quit [Changing host]
Tempesta has joined #ruby
Tempesta has quit [Excess Flood]
Tempesta has joined #ruby
Tempesta has quit [Changing host]
Tempesta has joined #ruby
Tempesta has quit [Excess Flood]
Tempesta has joined #ruby
Tempesta has quit [Changing host]
Tempesta has joined #ruby
Tempesta has quit [Excess Flood]
ih8u has joined #ruby
dviola has quit [Ping timeout: 265 seconds]
diego has joined #ruby
diego is now known as Guest5902
Guest5902 has left #ruby [WeeChat 4.4.3]
dviola has joined #ruby
jardsonto has quit [Remote host closed the connection]
user71 has joined #ruby
kludger__ has quit [Ping timeout: 260 seconds]
spikemaster has joined #ruby
spikemaster has left #ruby [ERC 5.6.1-git (IRC client for GNU Emacs 31.0.50)]
eddof13 has joined #ruby
kludger has joined #ruby
kludger has quit [Ping timeout: 246 seconds]
kludger has joined #ruby
trillion_exabyte has quit [Ping timeout: 276 seconds]
kludger_ has joined #ruby
trillion_exabyte has joined #ruby
kludger has quit [Ping timeout: 260 seconds]
user71 has quit [Ping timeout: 248 seconds]
eddof13 has quit [Quit: eddof13]
eddof13 has joined #ruby
kludger_ has quit [Ping timeout: 252 seconds]
kludger has joined #ruby
kludger has quit [Client Quit]
<havenwood>
kinduff: Fibers are quite nice in Ruby these days.
<havenwood>
If MilkMann comes back, check out the Async gem by the Ruby Core maintainer of Fiber and creator of the Fiber scheduler. It uses io-event, io-wait, etc in the stdlib for evented I/O using kqueue or epoll under the hood.
<havenwood>
I would 100% go with Async for I/O rather than Concurrent Ruby gem.
kludger has joined #ruby
kludger_ has joined #ruby
kludger has quit [Ping timeout: 252 seconds]
kludger has joined #ruby
kludger_ has quit [Ping timeout: 272 seconds]
kludger has quit [Ping timeout: 272 seconds]
user71 has joined #ruby
kludger has joined #ruby
vigumnov has joined #ruby
victori has quit [Ping timeout: 272 seconds]
tuxcrafter78 has quit [Quit: Client closed]
tuxcrafter78 has joined #ruby
___nick___ has joined #ruby
___nick___ has quit [Client Quit]
___nick___ has joined #ruby
hwpplayer1 has joined #ruby
kludger has quit [Quit: kludger]
eddof13 has quit [Quit: eddof13]
eddof13 has joined #ruby
Tempesta has joined #ruby
Tempesta has quit [Changing host]
Tempesta has joined #ruby
Tempesta has quit [Excess Flood]
Tempesta has joined #ruby
Tempesta has quit [Changing host]
Tempesta has joined #ruby
Tempesta has quit [Excess Flood]
kludger has joined #ruby
Tempesta has joined #ruby
Tempesta has quit [Changing host]
Tempesta has joined #ruby
Tempesta has quit [Excess Flood]
Tempesta has joined #ruby
Tempesta has quit [Changing host]
Tempesta has joined #ruby
Tempesta has quit [Excess Flood]
Tempesta has joined #ruby
Tempesta has quit [Changing host]
Tempesta has joined #ruby
Tempesta has quit [Excess Flood]
kludger_ has joined #ruby
Tempesta has joined #ruby
Tempesta has quit [Changing host]
Tempesta has joined #ruby
Tempesta has quit [Excess Flood]
kludger has quit [Ping timeout: 245 seconds]
Sampersand has joined #ruby
kludger has joined #ruby
kludger_ has quit [Ping timeout: 260 seconds]
kludger_ has joined #ruby
mms has quit [Changing host]
mms has joined #ruby
Sampersand has quit [Ping timeout: 256 seconds]
kludger has quit [Ping timeout: 260 seconds]
Sampersand has joined #ruby
<kinduff>
havenwood: oh nice, will check them out, since I discarded the idea a while ago
<Sampersand>
oo what
<Sampersand>
i havent touched fibers really
kludger has joined #ruby
kludger_ has quit [Ping timeout: 260 seconds]
cappy has joined #ruby
kludger has quit [Remote host closed the connection]
kludger has joined #ruby
kludger has quit [Remote host closed the connection]
kludger has joined #ruby
kludger has quit [Remote host closed the connection]
kludger has joined #ruby
hwpplayer1 has quit [Remote host closed the connection]
mms has quit [Quit: Reconnecting]
mms has joined #ruby
kludger has quit [Ping timeout: 260 seconds]
kludger has joined #ruby
grenierm has joined #ruby
szkl has quit [Quit: Connection closed for inactivity]
kludger has quit [Ping timeout: 244 seconds]
eddof13 has quit [Quit: eddof13]
dviola has quit [Read error: Connection reset by peer]
kludger has joined #ruby
Sampersand29 has joined #ruby
diego has joined #ruby
Sampersand has quit [Quit: Client closed]
diego is now known as Guest9016
Guest9016 has quit [Read error: Connection reset by peer]
dviola has joined #ruby
johnjaye has quit [Ping timeout: 265 seconds]
dviola has quit [Read error: Connection reset by peer]
eddof13 has joined #ruby
Sampersand has joined #ruby
Sampersand has quit [Quit: Client closed]
kludger has quit [Ping timeout: 244 seconds]
dviola has joined #ruby
kludger has joined #ruby
Sampersand29 has quit [Ping timeout: 256 seconds]
dviola has quit [Read error: Connection reset by peer]
johnjaye has joined #ruby
<adam12>
I'm using them for dnslint.com. Basically 100+ DNS queries each in a fiber. Very effective and simplified the original problem a lot (organizing all the queries and carrying context of their answers around).