<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>txbleehom (toby)</title>
    <link>https://ruby-china.org/txbleehom</link>
    <description></description>
    <language>en-us</language>
    <item>
      <title>诡异的 could not obtain a connection from the pool within 5.000 seconds</title>
      <description>&lt;p&gt;即使我连接池数给到很大，并发稍高一点就报连接池错误，看过很多帖子，Google 了很多文章，感觉都是配置 puma 的 workers，threads 然后相应提高 pool 值，我感觉我提高很大都没啥用，这是啥情况&lt;/p&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="n"&gt;could&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;obtain&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="n"&gt;connection&lt;/span&gt; &lt;span class="n"&gt;from&lt;/span&gt; &lt;span class="n"&gt;the&lt;/span&gt; &lt;span class="n"&gt;pool&lt;/span&gt; &lt;span class="n"&gt;within&lt;/span&gt; &lt;span class="mf"&gt;5.000&lt;/span&gt; &lt;span class="n"&gt;seconds&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;waited&lt;/span&gt; &lt;span class="mf"&gt;5.000&lt;/span&gt; &lt;span class="n"&gt;seconds&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="n"&gt;all&lt;/span&gt; &lt;span class="n"&gt;pooled&lt;/span&gt; &lt;span class="n"&gt;connections&lt;/span&gt; &lt;span class="n"&gt;were&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;use&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;服务器配置是 8 核 32g，数据库用的阿里云 pg 版 rds，puma 设置 workers 8，threads 8, 32，数据库配置 pool 给到 300 还是会报这个错误，我看 rds 监控图表连接数最大也就 70 左右的样子，看历史从来没超过这个值，不管我 pool 给多少感觉并发稍大就报这个。另外补充一下，服务器同时开启了 rpc，sidekiq 服务。&lt;/p&gt;</description>
      <author>txbleehom</author>
      <pubDate>Mon, 07 Nov 2022 16:53:03 +0800</pubDate>
      <link>https://ruby-china.org/topics/42726</link>
      <guid>https://ruby-china.org/topics/42726</guid>
    </item>
    <item>
      <title>分布式 ID 有什么好的建议</title>
      <description>&lt;p&gt;公司产品做的 saas 平台，ID 生成方案没有采用数据库自增，目前使用的是雪花算法的 ruby 实现，线上跑的单机，偶尔并发高会出现重复 id 插入失败，不知道是不是多进程导致的，然后现在要考虑部署多机器，听说雪花算法在多机器下不是完全单调递增，只是整体是递增趋势，这对数据库查询性能是不是有影响，现在用下来考虑是不是要换其他方案，网上关于分布式 id 的有很多，但是没找到 ruby 的相关实现，不知道大家在 rails 项目里有用到分布式 id 吗，有没有好的推荐，感谢！&lt;/p&gt;</description>
      <author>txbleehom</author>
      <pubDate>Sun, 09 Oct 2022 17:39:02 +0800</pubDate>
      <link>https://ruby-china.org/topics/42688</link>
      <guid>https://ruby-china.org/topics/42688</guid>
    </item>
    <item>
      <title>carrierwave-aliyun 可以生成 oss 智能媒体链接吗</title>
      <description>&lt;p&gt;使用 carrierwave-aliyun 生成下载链接没问题，但是现在需要使用 oss 的智能媒体服务在线预览文件，按照文档要求加了对应的参数就是不对，这种是不是不能用 carrierwave-aliyun，看 gem 包好像只实现了缩略图的功能&lt;/p&gt;

&lt;p&gt;&lt;img src="https://l.ruby-china.com/photo/txbleehom/b864dffe-3724-4a98-924f-f532310ecb4b.png!large" title="" alt=""&gt;
下载链接（&lt;a href="https://xxx.oss-cn-shanghai.aliyuncs.com/attachments/demo.xlsx?x-oss-process=imm%2Fpreviewdoc%2Ccopy_1&amp;amp;Expires=1662347160&amp;amp;OSSAccessKeyId=xxxx&amp;amp;Signature=xxx" rel="nofollow" target="_blank"&gt;https://xxx.oss-cn-shanghai.aliyuncs.com/attachments/demo.xlsx?x-oss-process=imm%2Fpreviewdoc%2Ccopy_1&amp;amp;Expires=1662347160&amp;amp;OSSAccessKeyId=xxxx&amp;amp;Signature=xxx&lt;/a&gt;）加了这个参数结果不对提示如下&lt;/p&gt;

&lt;p&gt;&lt;img src="https://l.ruby-china.com/photo/txbleehom/06c44b45-289a-430e-8a57-a794058e838c.png!large" title="" alt=""&gt;&lt;/p&gt;</description>
      <author>txbleehom</author>
      <pubDate>Mon, 05 Sep 2022 10:56:00 +0800</pubDate>
      <link>https://ruby-china.org/topics/42631</link>
      <guid>https://ruby-china.org/topics/42631</guid>
    </item>
    <item>
      <title>有没有可能基于 Ruby 封装一个自己的语言</title>
      <description>&lt;p&gt;项目有个需求，系统提供一些固定接口和基本的语法，然后用户可以自己写逻辑执行结果，目前我是直接用 ruby 语法写的公式，然后后台用 eval 执行结果，这样安全性肯定有问题，但是又想不出有什么好的方法可以避免这种安全问题，但又希望复用 ruby 的语法，各位有没有什么好的解决方案。
如果能达到 &lt;a href="https://deluge.zoho.com/tryout" rel="nofollow" target="_blank"&gt;https://deluge.zoho.com/tryout&lt;/a&gt; 这个效果就更好了，这个平台定义了自己语言，提供基本的语法给用户自己去调用执行，比如写个九九乘法表效果如图：
&lt;img src="https://l.ruby-china.com/photo/txbleehom/97f16873-3d37-42d2-af85-432412250637.png!large" title="" alt=""&gt;&lt;/p&gt;</description>
      <author>txbleehom</author>
      <pubDate>Wed, 08 Sep 2021 17:51:57 +0800</pubDate>
      <link>https://ruby-china.org/topics/41666</link>
      <guid>https://ruby-china.org/topics/41666</guid>
    </item>
  </channel>
</rss>
