{"action":"created","issue":{"url":"https://api.github.com/repos/mozilla-services/readinglist/issues/226","labels_url":"https://api.github.com/repos/mozilla-services/readinglist/issues/226/labels{/name}","comments_url":"https://api.github.com/repos/mozilla-services/readinglist/issues/226/comments","events_url":"https://api.github.com/repos/mozilla-services/readinglist/issues/226/events","html_url":"https://github.com/mozilla-services/readinglist/issues/226","id":64742960,"number":226,"title":"Better uwsgi deploy","user":{"login":"ametaireau","id":67073,"avatar_url":"https://avatars.githubusercontent.com/u/67073?v=3","gravatar_id":"","url":"https://api.github.com/users/ametaireau","html_url":"https://github.com/ametaireau","followers_url":"https://api.github.com/users/ametaireau/followers","following_url":"https://api.github.com/users/ametaireau/following{/other_user}","gists_url":"https://api.github.com/users/ametaireau/gists{/gist_id}","starred_url":"https://api.github.com/users/ametaireau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ametaireau/subscriptions","organizations_url":"https://api.github.com/users/ametaireau/orgs","repos_url":"https://api.github.com/users/ametaireau/repos","events_url":"https://api.github.com/users/ametaireau/events{/privacy}","received_events_url":"https://api.github.com/users/ametaireau/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/mozilla-services/readinglist/labels/production","name":"production","color":"eb6420"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-03-27T11:29:32Z","updated_at":"2015-03-27T16:23:20Z","closed_at":null,"body":"I've been reading [the uwsgi documentation](https://uwsgi-docs.readthedocs.org/) and while it's a bit hard to follow by times, it seems a bunch of interesting things could be tweaked in our setup. If you want to read a doc but don't know where to start, [the best practices doc](https://uwsgi-docs.readthedocs.org/en/latest/ThingsToKnow.html) is a good one.\r\n\r\n@michelletto , I think you'll like that!\r\n\r\n## What could (should?) be tweaked in our deployment\r\n\r\n- Nginx natively includes support for upstream servers speaking the uwsgi protocol since version 0.8.40. We have `1.6.2` on stage, so it's available;\r\n- It's possible to configure uwsgi directly with a socket (not with `-http`). This will spare us parsing the requests twice and will speed up a lot our service.\r\n- We should not enable thread supports as we don't need them in our app (at least for now) and it makes the uwsgi server slower;\r\n- Aparrently, the best way to integrate uwsgi with systemd is with [what they call an \"emperor\"](https://uwsgi-docs.readthedocs.org/en/latest/Systemd.html#adding-the-emperor-to-systemd)\r\n\r\n## Other interesting things to know\r\n\r\n- There is a `uwsgitop` tool which can help us to find the right number of processes (apparently, Simple math like `processes = 2 * cpucores` is not enough);\r\n- If our server seems to have lots of idle workers, but performance is still sub-par, we may want to look at the value of the `ip_conntrack_max` system variable (/proc/sys/net/ipv4/ip_conntrack_max) and increase it to see if it helps.\r\n"},"comment":{"url":"https://api.github.com/repos/mozilla-services/readinglist/issues/comments/86995019","html_url":"https://github.com/mozilla-services/readinglist/issues/226#issuecomment-86995019","issue_url":"https://api.github.com/repos/mozilla-services/readinglist/issues/226","id":86995019,"user":{"login":"pdehaan","id":557895,"avatar_url":"https://avatars.githubusercontent.com/u/557895?v=3","gravatar_id":"","url":"https://api.github.com/users/pdehaan","html_url":"https://github.com/pdehaan","followers_url":"https://api.github.com/users/pdehaan/followers","following_url":"https://api.github.com/users/pdehaan/following{/other_user}","gists_url":"https://api.github.com/users/pdehaan/gists{/gist_id}","starred_url":"https://api.github.com/users/pdehaan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pdehaan/subscriptions","organizations_url":"https://api.github.com/users/pdehaan/orgs","repos_url":"https://api.github.com/users/pdehaan/repos","events_url":"https://api.github.com/users/pdehaan/events{/privacy}","received_events_url":"https://api.github.com/users/pdehaan/received_events","type":"User","site_admin":false},"created_at":"2015-03-27T16:23:20Z","updated_at":"2015-03-27T16:23:20Z","body":"ping @micheletto"}}