TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

MRI Ruby + MySQL + Threads == Stop the world... JRuby doesn't

13 点作者 luccastera将近 17 年前

3 条评论

jrockway将近 17 年前
Solution: deal with MySQL in a separate process and talk to that process asynchronously from your app. A hack, perhaps, but if you need to use threads and Ruby, and Ruby can't call a C extension from multiple threads... this will fix the problem with about 20 minutes of development work. It would of course be better to fix Ruby, but that might take longer.<p>The least helpful thing to do, though, is to whine about it on your blog. Complain after you've fixed it :P
cosmo7将近 17 年前
It's quite disturbing to discover that it isn't just Rails that has the hobbyist-level db implementation.<p>In fact, there's no point for Rails to improve its lock-happy db adapters, since doing so will just reveal the Ruby bottleneck described here.
river_styx将近 17 年前
This is a good catch. I imagine that the vast majority of requests coming into a given Rails app cause the controller to perform some kind of synchronous data access to MySQL.