# Goodbye Sidetiq

**URL:** https://meta.discourse.org/t/goodbye-sidetiq/12476
**Category:** Feature
**Created:** [2014年二月5日 22:38 UTC](https://meta.discourse.org/t/goodbye-sidetiq/12476 "2014-02-05T22:38:31Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2014年二月5日 22:38 UTC](https://meta.discourse.org/t/goodbye-sidetiq/12476/1 "2014-02-05T22:38:31Z")

</div>

We have been plagued with problems related to our scheduler [sidetiq](https://github.com/tobiassvn/sidetiq).

In particular we have had a few major recurring issues related to high CPU

[https://meta.discourse.org/t/performance-issue-on-digital-ocean-with-discourse-docker/11895](https://meta.discourse.org/t/performance-issue-on-digital-ocean-with-discourse-docker/11895)

We have been working to address them upstream, however even once addressed there are some design issues that we need fixed as well.

Recently, I was debugging erratic perf issue with @supermathie here and found a second serious issue.

Sidetiq always schedules every job at exactly the same time, this leads to periods where the same job on every site we host runs at the same time leading to network saturation.

I have been building a light weight scheduler to address the perf and scheduling issues. I expect to have it done today.

So, this is just an upfront warning that the scheduler is changing, if you notice any new issues with scheduled jobs please let me know.

Commit that activates this is:

[https://github.com/discourse/discourse/commit/e1f293ad66d8557cca7054e82b96a4d1381d9e4a](https://github.com/discourse/discourse/commit/e1f293ad66d8557cca7054e82b96a4d1381d9e4a)

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2014年二月5日 22:38 UTC](https://meta.discourse.org/t/goodbye-sidetiq/12476/2 "2014-02-05T22:38:46Z")

</div>

This topic is now pinned. It will appear at the top of its category until it is either unpinned by a moderator, or the Clear Pin button is pressed.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2014年二月5日 23:43 UTC](https://meta.discourse.org/t/goodbye-sidetiq/12476/3 "2014-02-05T23:43:47Z")

</div>

Note: the UI is much improved over what sidetiq was giving us:

 ![](https://global.discourse-cdn.com/meta/original/2X/f/f8d40a8542200f5d25e6a100b8345ff35220f474.png)

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [2014年二月6日 00:45 UTC](https://meta.discourse.org/t/goodbye-sidetiq/12476/4 "2014-02-06T00:45:21Z")

</div>

Wow, that looks really nice! Will you be adding a link to it from the admin panel?

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2014年二月6日 00:58 UTC](https://meta.discourse.org/t/goodbye-sidetiq/12476/5 "2014-02-06T00:58:20Z")

</div>

Sure, open to that, where would you link this ?

---

<div class="post-metadata">

### Author: ![ambethia](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ambethia/32/108006_2.png) [@ambethia](https://meta.discourse.org/u/ambethia)
#### Post date: [2014年二月6日 15:59 UTC](https://meta.discourse.org/t/goodbye-sidetiq/12476/6 "2014-02-06T15:59:35Z")

</div>

This looks like something that’s a candidate for extracting into it’s own library. Thoughts?

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [2014年二月6日 16:09 UTC](https://meta.discourse.org/t/goodbye-sidetiq/12476/7 "2014-02-06T16:09:55Z")

</div>

> [@ambethia](#):
>
> This looks like something that’s a candidate for extracting into it’s own library. Thoughts?

Will require some real world usage first 😉

---

<div class="post-metadata">

### Author: ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)
#### Post date: [2014年二月6日 16:46 UTC](https://meta.discourse.org/t/goodbye-sidetiq/12476/8 "2014-02-06T16:46:52Z")

</div>

Nice, I’m glad to ditch a freedom patch too.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2014年二月7日 03:26 UTC](https://meta.discourse.org/t/goodbye-sidetiq/12476/9 "2014-02-07T03:26:40Z")

</div>

I am still holding back to see if tobias takes in all the features we need.

---

<div class="post-metadata">

### Author: ![jhofker](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jhofker/32/122450_2.png) [@jhofker](https://meta.discourse.org/u/jhofker)
#### Post date: [2014年二月7日 19:09 UTC](https://meta.discourse.org/t/goodbye-sidetiq/12476/10 "2014-02-07T19:09:32Z")

</div>

What’s the upgrade impact (if any) of this change and should the install/upgrade doc(s) be updated? [https://github.com/discourse/discourse/blob/master/docs/INSTALL-ubuntu.md](https://github.com/discourse/discourse/blob/master/docs/INSTALL-ubuntu.md)

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [2014年二月7日 19:27 UTC](https://meta.discourse.org/t/goodbye-sidetiq/12476/11 "2014-02-07T19:27:39Z")

</div>

We’re going to switch over to the Docker install instructions as the new standard next week. @sam I know that is on your list, but make sure.

The no-Docker, old style install will be available but not our primary supported or recommended install any more. So we’ll move it around a bit.

---

<div class="post-metadata">

### Author: ![jhofker](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jhofker/32/122450_2.png) [@jhofker](https://meta.discourse.org/u/jhofker)
#### Post date: [2014年二月7日 19:30 UTC](https://meta.discourse.org/t/goodbye-sidetiq/12476/12 "2014-02-07T19:30:57Z")

</div>

What’s the transition from an environment running no-Docker to Docker like?

(Sorry if I’m being annoying. Just wondering how much time I need to budget for this transition. 😄 (I have a Bitnami-created VM hosted on Azure))

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [2014年二月7日 20:26 UTC](https://meta.discourse.org/t/goodbye-sidetiq/12476/13 "2014-02-07T20:26:26Z")

</div>

Yes. We also want to have a “howto convert from regular to Docker install” posted soon. @sam has done a number of conversions from old-style Discourse install to new Docker installs now and has documented the process internally.

@zogstrip and @sam are working on necessary import/export improvements and once that is ready, it should go up.

---

<div class="post-metadata">

### Author: ![michaeld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/michaeld/32/1594_2.png) [@michaeld](https://meta.discourse.org/u/michaeld)
#### Post date: [2014年二月8日 14:43 UTC](https://meta.discourse.org/t/goodbye-sidetiq/12476/14 "2014-02-08T14:43:15Z")

</div>

> [@sam](#):
>
> So, this is just an upfront warning that the scheduler is changing, if you notice any new issues with scheduled jobs please let me know.

We’re having issues.

The sidekiq/scheduler page shows that all recurring jobs are ‘Not scheduled yet’

 ![](https://global.discourse-cdn.com/meta/original/2X/0/0e9a75c8b831ef1df5339cd23fea568396dfb979.png)

Hitting the ‘Trigger’ button on for instance ‘Version Checks’ results in a screen showing “Internal Server Error” and this in the logs:

```
    ArgumentError - comparison of Class with Class failed:
            /var/www/discourse/lib/scheduler/web.rb:10:in `sort'
            /var/www/discourse/lib/scheduler/web.rb:10:in `block (2 levels) in registered'
/var/www/discourse/vendor/gems/rails_multisite/lib/rails_multisite/connection_management.rb:45:in `with_connection'
            /var/www/discourse/lib/scheduler/web.rb:8:in `block in registered'

```

From that moment on, the scheduler screen is broken (keeps showing ‘Internal Server Error’ until Sidekiq is restarted.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2014年二月8日 20:30 UTC](https://meta.discourse.org/t/goodbye-sidetiq/12476/15 "2014-02-08T20:30:06Z")

</div>

What version of ruby are you on ?

---

<div class="post-metadata">

### Author: ![michaeld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/michaeld/32/1594_2.png) [@michaeld](https://meta.discourse.org/u/michaeld)
#### Post date: [2014年二月8日 20:36 UTC](https://meta.discourse.org/t/goodbye-sidetiq/12476/16 "2014-02-08T20:36:40Z")

</div>

ruby 2.0.0p353 (2013-11-22 revision 43784) [x86\_64-linux]

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2014年二月8日 20:50 UTC](https://meta.discourse.org/t/goodbye-sidetiq/12476/18 "2014-02-08T20:50:03Z")

</div>

is there anything custom in your initializer, you are going to need to trace through the sidekiq initializer to see why its not doing an initial enqueue of the jobs

---

<div class="post-metadata">

### Author: ![michaeld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/michaeld/32/1594_2.png) [@michaeld](https://meta.discourse.org/u/michaeld)
#### Post date: [2014年二月8日 20:55 UTC](https://meta.discourse.org/t/goodbye-sidetiq/12476/19 "2014-02-08T20:55:57Z")

</div>

(Your redis question apparently disappeared, but flushing redis _does_ make it recover from the “Internal Server Error” on sidekiq/scheduler)

The initializer is unmodified, actually this is a clean v0.9.8.4 checkout.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2014年二月8日 21:08 UTC](https://meta.discourse.org/t/goodbye-sidetiq/12476/20 "2014-02-08T21:08:58Z")

</div>

Can you do a clean checkout of master?

---

<div class="post-metadata">

### Author: ![michaeld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/michaeld/32/1594_2.png) [@michaeld](https://meta.discourse.org/u/michaeld)
#### Post date: [2014年二月8日 21:16 UTC](https://meta.discourse.org/t/goodbye-sidetiq/12476/21 "2014-02-08T21:16:54Z")

</div>

Sidekiq does seem to work, I see a ‘stat’ job coming by, it’s only the scheduled jobs that are failing.

Hitting the “Trigger” button on “Version check” does seem to run the version check, the following keys appear in redis

```
1) "default:last_installed_version"
 4) "default:missing_versions_count"
 5) "default:critical_updates_available"
 8) "default:last_version_check_at"
 9) "default:discourse_latest_version"
10) "default:_scheduler_Jobs::VersionCheck"
14) "default:_scheduler_queue_"

```

Removing the key “`default:_scheduler_Jobs::VersionCheck`” fixes the Internal Server Error

```
127.0.0.1:6379> get "default:_scheduler_Jobs::VersionCheck"
"{\"next_run\":1391979510,\"prev_run\":1391893854,\"prev_duration\":327,\"prev_result\":\"OK\"}"
127.0.0.1:6379> del "default:_scheduler_Jobs::VersionCheck"
(integer) 1

```

[下一頁](https://meta.discourse.org/t/goodbye-sidetiq/12476.md?page=2)
