Skip to content

Commit

Permalink
add google meet
Browse files Browse the repository at this point in the history
  • Loading branch information
jefer94 committed May 15, 2024
1 parent aafbb98 commit 8b3667b
Show file tree
Hide file tree
Showing 24 changed files with 2,503 additions and 184 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -182,3 +182,4 @@ dump.rdb
*:Zone.Identifier

node_modules/
.env*
150 changes: 150 additions & 0 deletions benchmarks/django-workers/bench6.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
# trio is not supported by django yet and should break gevent

FILE="./threads-py313.md"
CONNECTIONS=2000
THREADS=20
PORT=8000
HOST="http://localhost:$PORT"
TIMEOUT=10
SLEEP_TIME=3


# it support wsgi and asgi
function bench {
HOST="http://localhost:8000"

echo "" >> "$FILE"
echo "### JSON performance" >> "$FILE"
echo "#### Sync" >> "$FILE"
echo "" >> "$FILE"
echo "\`\`\`bash" >> "$FILE"
wrk -t "$THREADS" -c "$CONNECTIONS" -d10s "$HOST/myapp/sync/json" >> "$FILE"
echo "\`\`\`" >> "$FILE"
echo "" >> "$FILE"
echo "#### Async" >> "$FILE"
echo "" >> "$FILE"
echo "\`\`\`bash" >> "$FILE"
wrk -t "$THREADS" -c "$CONNECTIONS" -d10s "$HOST/myapp/async/json" >> "$FILE"
echo "\`\`\`" >> "$FILE"
echo "" >> "$FILE"

echo "### Queries returned as JSON" >> "$FILE"
echo "#### Sync" >> "$FILE"
echo "" >> "$FILE"
echo "\`\`\`bash" >> "$FILE"
wrk -t "$THREADS" -c "$CONNECTIONS" -d10s "$HOST/myapp/sync/json_query" >> "$FILE"
echo "\`\`\`" >> "$FILE"
echo "" >> "$FILE"
echo "#### Async" >> "$FILE"
echo "" >> "$FILE"
echo "\`\`\`bash" >> "$FILE"
wrk -t "$THREADS" -c "$CONNECTIONS" -d10s "$HOST/myapp/async/json_query" >> "$FILE"
echo "\`\`\`" >> "$FILE"
echo "" >> "$FILE"

echo "### Queries returned as HTML" >> "$FILE"
echo "#### Sync" >> "$FILE"
echo "" >> "$FILE"
echo "\`\`\`bash" >> "$FILE"
wrk -t "$THREADS" -c "$CONNECTIONS" -d10s "$HOST/myapp/sync/template_query" >> "$FILE"
echo "\`\`\`" >> "$FILE"
echo "" >> "$FILE"
echo "#### Async" >> "$FILE"
echo "" >> "$FILE"
echo "\`\`\`bash" >> "$FILE"
wrk -t "$THREADS" -c "$CONNECTIONS" -d10s "$HOST/myapp/async/template_query" >> "$FILE"
echo "\`\`\`" >> "$FILE"
echo "" >> "$FILE"

echo "### Simulate a request 1s inside the server, then return a JSON" >> "$FILE"
echo "#### Sync" >> "$FILE"
echo "" >> "$FILE"
echo "\`\`\`bash" >> "$FILE"
wrk -t "$THREADS" -c "$CONNECTIONS" -d10s "$HOST/myapp/sync/gateway_1s" >> "$FILE"
echo "\`\`\`" >> "$FILE"
echo "" >> "$FILE"
echo "#### Async" >> "$FILE"
echo "" >> "$FILE"
echo "\`\`\`bash" >> "$FILE"
wrk -t "$THREADS" -c "$CONNECTIONS" -d10s "$HOST/myapp/async/gateway_1s" >> "$FILE"
echo "\`\`\`" >> "$FILE"
echo "" >> "$FILE"

sleep $SLEEP_TIME

echo "### Simulate a request 3s inside the server, then return a JSON" >> "$FILE"
echo "#### Sync" >> "$FILE"
echo "" >> "$FILE"
echo "\`\`\`bash" >> "$FILE"
wrk -t "$THREADS" -c "$CONNECTIONS" -d10s "$HOST/myapp/sync/gateway_3s" >> "$FILE"
echo "\`\`\`" >> "$FILE"
echo "" >> "$FILE"
echo "#### Async" >> "$FILE"
echo "" >> "$FILE"
echo "\`\`\`bash" >> "$FILE"
wrk -t "$THREADS" -c "$CONNECTIONS" -d10s "$HOST/myapp/async/gateway_3s" >> "$FILE"
echo "\`\`\`" >> "$FILE"
echo "" >> "$FILE"

sleep $SLEEP_TIME

echo "### Simulate a request 10s inside the server, then return a JSON" >> "$FILE"
echo "#### Sync" >> "$FILE"
echo "" >> "$FILE"
echo "\`\`\`bash" >> "$FILE"
wrk -t "$THREADS" -c "$CONNECTIONS" -d10s "$HOST/myapp/sync/gateway_10s" >> "$FILE"
echo "\`\`\`" >> "$FILE"
echo "" >> "$FILE"
echo "#### Async" >> "$FILE"
echo "" >> "$FILE"
echo "\`\`\`bash" >> "$FILE"
wrk -t "$THREADS" -c "$CONNECTIONS" -d10s "$HOST/myapp/async/gateway_10s" >> "$FILE"
echo "\`\`\`" >> "$FILE"
echo "" >> "$FILE"

sleep $SLEEP_TIME

echo "### Brotli" >> "$FILE"
echo "#### Sync" >> "$FILE"
echo "" >> "$FILE"
echo "\`\`\`bash" >> "$FILE"
wrk -t "$THREADS" -c "$CONNECTIONS" -d10s "$HOST/myapp/sync/brotli" >> "$FILE"
echo "\`\`\`" >> "$FILE"
echo "" >> "$FILE"
echo "#### Async" >> "$FILE"
echo "" >> "$FILE"
echo "\`\`\`bash" >> "$FILE"
wrk -t "$THREADS" -c "$CONNECTIONS" -d10s "$HOST/myapp/async/brotli" >> "$FILE"
echo "\`\`\`" >> "$FILE"
echo "" >> "$FILE"
}


echo "# Django Workers" > $FILE

sudo fuser -k $PORT/tcp
PYTHON_GIL=0 python -Xgil=0 -m gunicorn mysite.asgi --timeout $TIMEOUT --threads $THREADS --worker-class uvicorn.workers.UvicornWorker & echo "starting server..."
sleep $SLEEP_TIME
echo "## ASGI Gunicorn Uvicorn, with threads -Xgil=0" >> $FILE
bench

sudo fuser -k $PORT/tcp
PYTHON_GIL=1 python -Xgil=1 -m gunicorn mysite.asgi --timeout $TIMEOUT --threads $THREADS --worker-class uvicorn.workers.UvicornWorker & echo "starting server..."
sleep $SLEEP_TIME
echo "## ASGI Gunicorn Uvicorn, with threads -Xgil=1" >> $FILE
bench

sudo fuser -k $PORT/tcp
PYTHON_GIL=0 python -Xgil=0 -m gunicorn mysite.asgi --timeout $TIMEOUT --workers $THREADS --worker-class uvicorn.workers.UvicornWorker & echo "starting server..."
sleep $SLEEP_TIME
echo "## ASGI Gunicorn Uvicorn, with workers -Xgil=0" >> $FILE
bench

sudo fuser -k $PORT/tcp
PYTHON_GIL=1 python -Xgil=1 -m gunicorn mysite.asgi --timeout $TIMEOUT --workers $THREADS --worker-class uvicorn.workers.UvicornWorker & echo "starting server..."
sleep $SLEEP_TIME
echo "## ASGI Gunicorn Uvicorn, with workers -Xgil=1" >> $FILE
bench


sudo fuser -k $PORT/tcp
Loading

0 comments on commit 8b3667b

Please sign in to comment.