- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我曾经将很多代码包装在 Thread.new {}
中,然后开始偶然发现 Sidekiq 以使后台任务变得更容易一些。几周后,情况令人失望,我不知道这是否是我将代码放入我的 sidekiq 工作人员的方式或交易是什么。
例如,
[1] pry(#<DomainWorker>)> domain = Domain.find_by(unique_id: @unique_id)
[2] pry(#<DomainWorker>)> urls
=> [{:url=>"http://admin.example.com/"}, {:url=>"http://example.com/"}, {:url=>"http://www.example.com/"}, {:url=>"https://admin.example.com/"}, {:url=>"https://example.com/"}, {:url=>"https://www.example.com/"}]
[3] pry(#<DomainWorker>)> domain.domain_urls.build(urls)
=> [#<DomainUrl:0x0000557c97f2a3c8 id: nil, domain_id: 32, url: "http://admin.example.com/", created_at: nil, updated_at: nil>,
#<DomainUrl:0x0000557c97cc6e38 id: nil, domain_id: 32, url: "http://example.com/", created_at: nil, updated_at: nil>,
#<DomainUrl:0x0000557c97cadd70 id: nil, domain_id: 32, url: "http://www.example.com/", created_at: nil, updated_at: nil>,
#<DomainUrl:0x0000557c97c9c8e0 id: nil, domain_id: 32, url: "https://admin.example.com/", created_at: nil, updated_at: nil>,
#<DomainUrl:0x0000557c97c7ed18 id: nil, domain_id: 32, url: "https://example.com/", created_at: nil, updated_at: nil>,
#<DomainUrl:0x0000557c97c43df8 id: nil, domain_id: 32, url: "https://www.example.com/", created_at: nil, updated_at: nil>]
仅仅运行domain.domain_urls.build(urls)
命令就需要大约15秒的时间来执行。如果我打开rails c,该命令会立即运行。
这是否违反了操纵 sidekiq 工作人员模型或其他内容的最佳实践?不知道为什么有时需要 15-20 秒,下一次需要 5 秒,等等。这是非常不一致的。我什至有一个 MailWorker,有时需要 2 秒或 2 分钟才能发送电子邮件。不确定这笔交易是什么。
这是我的 config/sidekiq.yml
配置文件:
development:
:concurrency: 50
production:
:concurrency: 50
:queues:
- default
这是我的代码还是 Sidekiq 不擅长完成这些任务?我在这里缺少什么?
编辑
在我的开发环境中简单地禁用 eager_load
似乎取得了一些进展。
在config/environments/development.rb
中:
改变了
config.eager_load = false
至
config.eager_load = true
它可以工作一段时间,但在一堆任务排队并完成后,它又开始挂起。现在又卡住了。
如果我在 MySQL 中运行 show processlist
,我会看到以下内容:
mysql> show full processlist;
+----+------------+-----------+-------------------+---------+------+----------+-----------------------+
| Id | User | Host | db | Command | Time | State | Info |
+----+------------+-----------+-------------------+---------+------+----------+-----------------------+
| 31 | app_dev | localhost | app_portal_dev | Sleep | 1017 | | NULL |
| 50 | root | localhost | NULL | Query | 0 | starting | show full processlist |
| 55 | app_dev | localhost | app_portal_dev | Sleep | 1059 | | NULL |
| 57 | app_dev | localhost | app_portal_dev | Sleep | 1028 | | NULL |
| 58 | app_dev | localhost | app_portal_dev | Sleep | 420 | | NULL |
| 61 | app_dev | localhost | app_portal_dev | Sleep | 1078 | | NULL |
| 62 | app_dev | localhost | app_portal_dev | Sleep | 425 | | NULL |
| 63 | app_dev | localhost | app_portal_dev | Sleep | 191 | | NULL |
+----+------------+-----------+-------------------+---------+------+----------+-----------------------+
8 rows in set (0.00 sec)
此外,如果我向 Sidekiq 工作程序发送终止 TTIN 信号,则输出如下:
2018-11-03T03:20:29.415Z 65977 TID-gsr3safel WARN: Thread TID-gsr4jqd7l processor
2018-11-03T03:20:29.415Z 65977 TID-gsr3safel WARN: /home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/connection/ruby.rb:68:in `select'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/connection/ruby.rb:68:in `rescue in _read_from_socket'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/connection/ruby.rb:64:in `_read_from_socket'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/connection/ruby.rb:56:in `gets'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/connection/ruby.rb:363:in `read'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:263:in `block in read'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:251:in `io'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:262:in `read'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:118:in `block in call'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:232:in `block (2 levels) in process'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:370:in `ensure_connected'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:222:in `block in process'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:307:in `logging'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:221:in `process'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:118:in `call'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:210:in `block in call_with_timeout'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:281:in `with_socket_timeout'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:209:in `call_with_timeout'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis.rb:1172:in `block in _bpop'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis.rb:45:in `block in synchronize'
/home/myuser/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/monitor.rb:226:in `mon_synchronize'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis.rb:45:in `synchronize'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis.rb:1169:in `_bpop'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis.rb:1214:in `brpop'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.2/lib/sidekiq/fetch.rb:36:in `block in retrieve_work'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.2/lib/sidekiq.rb:95:in `block in redis'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/connection_pool-2.2.2/lib/connection_pool.rb:65:in `block (2 levels) in with'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/connection_pool-2.2.2/lib/connection_pool.rb:64:in `handle_interrupt'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/connection_pool-2.2.2/lib/connection_pool.rb:64:in `block in with'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/connection_pool-2.2.2/lib/connection_pool.rb:61:in `handle_interrupt'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/connection_pool-2.2.2/lib/connection_pool.rb:61:in `with'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.2/lib/sidekiq.rb:92:in `redis'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.2/lib/sidekiq/fetch.rb:36:in `retrieve_work'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.2/lib/sidekiq/processor.rb:89:in `get_one'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.2/lib/sidekiq/processor.rb:99:in `fetch'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.2/lib/sidekiq/processor.rb:82:in `process_one'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.2/lib/sidekiq/processor.rb:71:in `run'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.2/lib/sidekiq/util.rb:16:in `watchdog'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.2/lib/sidekiq/util.rb:25:in `block in safe_thread'
2018-11-03T03:20:29.416Z 65977 TID-gsr3safel WARN: Thread TID-gsr4jqddx processor
2018-11-03T03:20:29.416Z 65977 TID-gsr3safel WARN: /home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/connection/ruby.rb:68:in `select'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/connection/ruby.rb:68:in `rescue in _read_from_socket'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/connection/ruby.rb:64:in `_read_from_socket'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/connection/ruby.rb:56:in `gets'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/connection/ruby.rb:363:in `read'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:263:in `block in read'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:251:in `io'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:262:in `read'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:118:in `block in call'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:232:in `block (2 levels) in process'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:370:in `ensure_connected'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:222:in `block in process'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:307:in `logging'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:221:in `process'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:118:in `call'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:210:in `block in call_with_timeout'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:281:in `with_socket_timeout'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:209:in `call_with_timeout'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis.rb:1172:in `block in _bpop'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis.rb:45:in `block in synchronize'
/home/myuser/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/monitor.rb:226:in `mon_synchronize'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis.rb:45:in `synchronize'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis.rb:1169:in `_bpop'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis.rb:1214:in `brpop'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.2/lib/sidekiq/fetch.rb:36:in `block in retrieve_work'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.2/lib/sidekiq.rb:95:in `block in redis'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/connection_pool-2.2.2/lib/connection_pool.rb:65:in `block (2 levels) in with'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/connection_pool-2.2.2/lib/connection_pool.rb:64:in `handle_interrupt'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/connection_pool-2.2.2/lib/connection_pool.rb:64:in `block in with'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/connection_pool-2.2.2/lib/connection_pool.rb:61:in `handle_interrupt'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/connection_pool-2.2.2/lib/connection_pool.rb:61:in `with'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.2/lib/sidekiq.rb:92:in `redis'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.2/lib/sidekiq/fetch.rb:36:in `retrieve_work'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.2/lib/sidekiq/processor.rb:89:in `get_one'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.2/lib/sidekiq/processor.rb:99:in `fetch'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.2/lib/sidekiq/processor.rb:82:in `process_one'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.2/lib/sidekiq/processor.rb:71:in `run'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.2/lib/sidekiq/util.rb:16:in `watchdog'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.2/lib/sidekiq/util.rb:25:in `block in safe_thread'
2018-11-03T03:20:29.416Z 65977 TID-gsr3safel WARN: Thread TID-gsr4jqdh1 processor
2018-11-03T03:20:29.416Z 65977 TID-gsr3safel WARN: /home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/connection/ruby.rb:68:in `select'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/connection/ruby.rb:68:in `rescue in _read_from_socket'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/connection/ruby.rb:64:in `_read_from_socket'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/connection/ruby.rb:56:in `gets'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/connection/ruby.rb:363:in `read'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:263:in `block in read'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:251:in `io'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:262:in `read'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:118:in `block in call'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:232:in `block (2 levels) in process'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:370:in `ensure_connected'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:222:in `block in process'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:307:in `logging'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:221:in `process'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:118:in `call'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:210:in `block in call_with_timeout'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:281:in `with_socket_timeout'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:209:in `call_with_timeout'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis.rb:1172:in `block in _bpop'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis.rb:45:in `block in synchronize'
/home/myuser/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/monitor.rb:226:in `mon_synchronize'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis.rb:45:in `synchronize'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis.rb:1169:in `_bpop'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis.rb:1214:in `brpop'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.2/lib/sidekiq/fetch.rb:36:in `block in retrieve_work'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.2/lib/sidekiq.rb:95:in `block in redis'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/connection_pool-2.2.2/lib/connection_pool.rb:65:in `block (2 levels) in with'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/connection_pool-2.2.2/lib/connection_pool.rb:64:in `handle_interrupt'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/connection_pool-2.2.2/lib/connection_pool.rb:64:in `block in with'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/connection_pool-2.2.2/lib/connection_pool.rb:61:in `handle_interrupt'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/connection_pool-2.2.2/lib/connection_pool.rb:61:in `with'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.2/lib/sidekiq.rb:92:in `redis'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.2/lib/sidekiq/fetch.rb:36:in `retrieve_work'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.2/lib/sidekiq/processor.rb:89:in `get_one'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.2/lib/sidekiq/processor.rb:99:in `fetch'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.2/lib/sidekiq/processor.rb:82:in `process_one'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.2/lib/sidekiq/processor.rb:71:in `run'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.2/lib/sidekiq/util.rb:16:in `watchdog'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.2/lib/sidekiq/util.rb:25:in `block in safe_thread'
2018-11-03T03:20:29.417Z 65977 TID-gsr3safel WARN: Thread TID-gsr4jqcuh processor
2018-11-03T03:20:29.417Z 65977 TID-gsr3safel WARN: /home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/connection/ruby.rb:68:in `select'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/connection/ruby.rb:68:in `rescue in _read_from_socket'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/connection/ruby.rb:64:in `_read_from_socket'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/connection/ruby.rb:56:in `gets'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/connection/ruby.rb:363:in `read'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:263:in `block in read'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:251:in `io'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:262:in `read'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:118:in `block in call'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:232:in `block (2 levels) in process'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:370:in `ensure_connected'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:222:in `block in process'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:307:in `logging'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:221:in `process'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:118:in `call'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:210:in `block in call_with_timeout'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:281:in `with_socket_timeout'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:209:in `call_with_timeout'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis.rb:1172:in `block in _bpop'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis.rb:45:in `block in synchronize'
/home/myuser/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/monitor.rb:226:in `mon_synchronize'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis.rb:45:in `synchronize'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis.rb:1169:in `_bpop'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis.rb:1214:in `brpop'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.2/lib/sidekiq/fetch.rb:36:in `block in retrieve_work'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.2/lib/sidekiq.rb:95:in `block in redis'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/connection_pool-2.2.2/lib/connection_pool.rb:65:in `block (2 levels) in with'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/connection_pool-2.2.2/lib/connection_pool.rb:64:in `handle_interrupt'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/connection_pool-2.2.2/lib/connection_pool.rb:64:in `block in with'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/connection_pool-2.2.2/lib/connection_pool.rb:61:in `handle_interrupt'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/connection_pool-2.2.2/lib/connection_pool.rb:61:in `with'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.2/lib/sidekiq.rb:92:in `redis'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.2/lib/sidekiq/fetch.rb:36:in `retrieve_work'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.2/lib/sidekiq/processor.rb:89:in `get_one'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.2/lib/sidekiq/processor.rb:99:in `fetch'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.2/lib/sidekiq/processor.rb:82:in `process_one'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.2/lib/sidekiq/processor.rb:71:in `run'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.2/lib/sidekiq/util.rb:16:in `watchdog'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.2/lib/sidekiq/util.rb:25:in `block in safe_thread'
2018-11-03T03:20:29.417Z 65977 TID-gsr3safel WARN: Thread TID-gsr4jqd4p processor
2018-11-03T03:20:29.417Z 65977 TID-gsr3safel WARN: /home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/connection/ruby.rb:68:in `select'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/connection/ruby.rb:68:in `rescue in _read_from_socket'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/connection/ruby.rb:64:in `_read_from_socket'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/connection/ruby.rb:56:in `gets'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/connection/ruby.rb:363:in `read'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:263:in `block in read'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:251:in `io'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:262:in `read'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:118:in `block in call'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:232:in `block (2 levels) in process'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:370:in `ensure_connected'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:222:in `block in process'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:307:in `logging'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:221:in `process'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:118:in `call'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:210:in `block in call_with_timeout'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:281:in `with_socket_timeout'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:209:in `call_with_timeout'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis.rb:1172:in `block in _bpop'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis.rb:45:in `block in synchronize'
/home/myuser/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/monitor.rb:226:in `mon_synchronize'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis.rb:45:in `synchronize'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis.rb:1169:in `_bpop'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis.rb:1214:in `brpop'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.2/lib/sidekiq/fetch.rb:36:in `block in retrieve_work'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.2/lib/sidekiq.rb:95:in `block in redis'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/connection_pool-2.2.2/lib/connection_pool.rb:65:in `block (2 levels) in with'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/connection_pool-2.2.2/lib/connection_pool.rb:64:in `handle_interrupt'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/connection_pool-2.2.2/lib/connection_pool.rb:64:in `block in with'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/connection_pool-2.2.2/lib/connection_pool.rb:61:in `handle_interrupt'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/connection_pool-2.2.2/lib/connection_pool.rb:61:in `with'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.2/lib/sidekiq.rb:92:in `redis'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.2/lib/sidekiq/fetch.rb:36:in `retrieve_work'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.2/lib/sidekiq/processor.rb:89:in `get_one'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.2/lib/sidekiq/processor.rb:99:in `fetch'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.2/lib/sidekiq/processor.rb:82:in `process_one'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.2/lib/sidekiq/processor.rb:71:in `run'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.2/lib/sidekiq/util.rb:16:in `watchdog'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.2/lib/sidekiq/util.rb:25:in `block in safe_thread'
2018-11-03T03:20:29.418Z 65977 TID-gsr3safel WARN: Thread TID-gsr4jqcn5 processor
2018-11-03T03:20:29.418Z 65977 TID-gsr3safel WARN: /home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/connection/ruby.rb:68:in `select'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/connection/ruby.rb:68:in `rescue in _read_from_socket'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/connection/ruby.rb:64:in `_read_from_socket'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/connection/ruby.rb:56:in `gets'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/connection/ruby.rb:363:in `read'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:263:in `block in read'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:251:in `io'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:262:in `read'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:118:in `block in call'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:232:in `block (2 levels) in process'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:370:in `ensure_connected'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:222:in `block in process'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:307:in `logging'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:221:in `process'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:118:in `call'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:210:in `block in call_with_timeout'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:281:in `with_socket_timeout'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis/client.rb:209:in `call_with_timeout'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis.rb:1172:in `block in _bpop'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis.rb:45:in `block in synchronize'
/home/myuser/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/monitor.rb:226:in `mon_synchronize'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis.rb:45:in `synchronize'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis.rb:1169:in `_bpop'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/redis-4.0.2/lib/redis.rb:1214:in `brpop'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.2/lib/sidekiq/fetch.rb:36:in `block in retrieve_work'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.2/lib/sidekiq.rb:95:in `block in redis'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/connection_pool-2.2.2/lib/connection_pool.rb:65:in `block (2 levels) in with'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/connection_pool-2.2.2/lib/connection_pool.rb:64:in `handle_interrupt'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/connection_pool-2.2.2/lib/connection_pool.rb:64:in `block in with'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/connection_pool-2.2.2/lib/connection_pool.rb:61:in `handle_interrupt'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/connection_pool-2.2.2/lib/connection_pool.rb:61:in `with'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.2/lib/sidekiq.rb:92:in `redis'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.2/lib/sidekiq/fetch.rb:36:in `retrieve_work'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.2/lib/sidekiq/processor.rb:89:in `get_one'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.2/lib/sidekiq/processor.rb:99:in `fetch'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.2/lib/sidekiq/processor.rb:82:in `process_one'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.2/lib/sidekiq/processor.rb:71:in `run'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.2/lib/sidekiq/util.rb:16:in `watchdog'
/home/myuser/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.2/lib/sidekiq/util.rb:25:in `block in safe_thread'
最佳答案
Rails 开发模式自动加载是单线程的。您可以将 Sidekiq 设置为您想要的任何并发数,但您仍然会有一个巨大的互斥锁来单线程您的作业,以便它们可以安全地自动加载。打开 eager_load 或切换到生产模式会禁用自动加载。
并发:50 太高了。不要将其设置高于 25。
也可能您有大量线程,但数据库连接数量不同,请在 config/database.yml
中设置 pool: 25
关于mysql - 是我的代码问题还是 Sidekiq 速度慢,因为它不应该访问 Rails 模型?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53127788/
我尝试理解[c代码 -> 汇编]代码 void node::Check( data & _data1, vector& _data2) { -> push ebp -> mov ebp,esp ->
我需要在当前表单(代码)的上下文中运行文本文件中的代码。其中一项要求是让代码创建新控件并将其添加到当前窗体。 例如,在Form1.cs中: using System.Windows.Forms; ..
我有此 C++ 代码并将其转换为 C# (.net Framework 4) 代码。有没有人给我一些关于 malloc、free 和 sprintf 方法的提示? int monate = ee; d
我的网络服务器代码有问题 #include #include #include #include #include #include #include int
给定以下 html 代码,将列表中的第三个元素(即“美丽”一词)以斜体显示的 CSS 代码是什么?当然,我可以给这个元素一个 id 或一个 class,但 html 代码必须保持不变。谢谢
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 我们不允许提问寻求书籍、工具、软件库等的推荐。您可以编辑问题,以便用事实和引用来回答。 关闭 7 年前。
我试图制作一个宏来避免重复代码和注释。 我试过这个: #define GrowOnPage(any Page, any Component) Component.Width := Page.Surfa
我正在尝试将我的旧 C++ 代码“翻译”成头条新闻所暗示的 C# 代码。问题是我是 C# 中的新手,并不是所有的东西都像 C++ 中那样。在 C++ 中这些解决方案运行良好,但在 C# 中只是不能。我
在 Windows 10 上工作,R 语言的格式化程序似乎没有在 Visual Studio Code 中完成它的工作。我试过R support for Visual Studio Code和 R-T
我正在处理一些报告(计数),我必须获取不同参数的计数。非常简单但乏味。 一个参数的示例查询: qCountsEmployee = ( "select count(*) from %s wher
最近几天我尝试从 d00m 调试网络错误。我开始用尽想法/线索,我希望其他 SO 用户拥有可能有用的宝贵经验。我希望能够提供所有相关信息,但我个人无法控制服务器环境。 整个事情始于用户注意到我们应用程
我有一个 app.js 文件,其中包含如下 dojo amd 模式代码: require(["dojo/dom", ..], function(dom){ dom.byId('someId').i
我对“-gencode”语句中的“code=sm_X”选项有点困惑。 一个例子:NVCC 编译器选项有什么作用 -gencode arch=compute_13,code=sm_13 嵌入库中? 只有
我为我的表格使用 X-editable 框架。 但是我有一些问题。 $(document).ready(function() { $('.access').editable({
我一直在通过本教程学习 flask/python http://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-hello-wo
我想将 Vim 和 EMACS 用于 CNC、G 代码和 M 代码。 Vim 或 EMACS 是否有任何语法或模式来处理这种类型的代码? 最佳答案 一些快速搜索使我找到了 this vim 和 thi
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 想改进这个问题?更新问题,使其成为 on-topic对于堆栈溢出。 7年前关闭。 Improve this
这个问题在这里已经有了答案: Enabling markdown highlighting in Vim (5 个回答) 6年前关闭。 当我在 Vim 中编辑包含 Markdown 代码的 READM
我正在 Swift3 iOS 中开发视频应用程序。基本上我必须将视频 Assets 和音频与淡入淡出效果合并为一个并将其保存到 iPhone 画廊。为此,我使用以下方法: private func d
pipeline { agent any stages { stage('Build') { steps { e
我是一名优秀的程序员,十分优秀!