PING_INLINE: 68259.38 requests per second
PING_BULK: 80840.74 requests per second
SET: 61236.99 requests per second
GET: 81766.15 requests per second
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AUTH | |
---- | |
TODO | |
USERS | |
----- | |
Note: /user and /users are defined seperatley. | |
'user' refers to yourself, the authenticated user |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
debian@control:~$ redis-benchmark -q | |
PING_INLINE: 126582.27 requests per second | |
PING_BULK: 125000.00 requests per second | |
SET: 128205.12 requests per second | |
GET: 126582.27 requests per second | |
INCR: 116279.06 requests per second | |
LPUSH: 99009.90 requests per second | |
LPOP: 97087.38 requests per second | |
SADD: 99009.90 requests per second | |
SPOP: 97087.38 requests per second |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if not app.debug: # pragma: no cover | |
import logging | |
from logging.handlers import SMTPHandler | |
mail_handler = SMTPHandler( | |
('smtp.mailgun.org', 25), | |
'[email protected]', | |
['[email protected]'], | |
'Application Error', | |
(USERNAME, PASSWORD) | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from redis import StrictRedis | |
hostname = '' | |
r = StrictRedis(hostname) | |
for key in r.keys('{alerts:*}'): | |
ttl = r.ttl(key) | |
if ttl == -1: | |
r.delete(key) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
from collections import Counter | |
def get_follow_suggestions(user_id, count=5): | |
# Get all users a user is following | |
following = r.zrange(k.USER_FOLLOWING.format(user_id), 0, -1) | |
# Ensure the user is getting suggestions based on at least 5 people | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Remove < 3.2 cache | |
find . -type f -name \*.pyc -delete | |
# Remove > 3.2 cache | |
find . -type d -name "__pycache__" -delete |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Pjuu | |
After=network.target | |
[Service] | |
PIDFile=/run/pjuu/pid | |
User=pjuu | |
Group=pjuu | |
WorkingDirectory=/pjuu/app | |
ExecStart=/pjuu/venv/bin/gunicorn --pid /run/pjuu/pid wsgi:application |
Swappiness controls the tendancy the kernel wishes to swap.
Even with free memory the kernel may swap.
100 means aggressively swap 0 means wait until the last minute to swap
To check current swappiness
cat /proc/sys/vm/swappiness
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PJUU_SETTINGS=/pjuu/conf/settings.py WEB_CONCURRENCY=`nproc` gunicorn -b 127.0.0.1:8000 -D -k gevent pjuu.wsgi |
OlderNewer