mirror of
https://github.com/django/daphne.git
synced 2025-04-20 08:42:18 +03:00
* Do not generate new fingerprint when connection fails * Do not try to print latencies when all connections failed * Update asgi_redis and channels versions in Dockerfile
This commit is contained in:
parent
1d93037bb7
commit
6c471ef915
|
@ -12,13 +12,13 @@ RUN apt-get update && \
|
|||
|
||||
# Install asgi_redis driver and most recent Daphne
|
||||
RUN pip install \
|
||||
asgi_redis==0.8.3 \
|
||||
asgi_redis==1.0.0 \
|
||||
git+https://github.com/django/daphne.git@#egg=daphne
|
||||
|
||||
# Clone Channels and install it
|
||||
RUN git clone https://github.com/django/channels.git /srv/channels/ && \
|
||||
cd /srv/channels && \
|
||||
git reset --hard caa589ae708a1a66ba1bdcd24f5fd473040772bd && \
|
||||
git reset --hard origin/master && \
|
||||
python setup.py install
|
||||
|
||||
WORKDIR /srv/channels/testproject/
|
||||
|
|
|
@ -70,7 +70,6 @@ class MyClientProtocol(WebSocketClientProtocol):
|
|||
"connect": True,
|
||||
}
|
||||
else:
|
||||
self.fingerprint = "".join(random.choice("abcdefghijklmnopqrstuvwxyz") for i in range(16))
|
||||
stats[self.fingerprint] = {
|
||||
"sent": 0,
|
||||
"received": 0,
|
||||
|
@ -168,22 +167,26 @@ class Benchmarker(object):
|
|||
num_out_of_order += 1
|
||||
else:
|
||||
num_good += 1
|
||||
# Some analysis on latencies
|
||||
latency_mean = statistics.mean(latencies)
|
||||
latency_median = statistics.median(latencies)
|
||||
latency_stdev = statistics.stdev(latencies)
|
||||
latency_95 = self.percentile(latencies, 0.95)
|
||||
latency_99 = self.percentile(latencies, 0.99)
|
||||
|
||||
if latencies:
|
||||
# Some analysis on latencies
|
||||
latency_mean = statistics.mean(latencies)
|
||||
latency_median = statistics.median(latencies)
|
||||
latency_stdev = statistics.stdev(latencies)
|
||||
latency_95 = self.percentile(latencies, 0.95)
|
||||
latency_99 = self.percentile(latencies, 0.99)
|
||||
|
||||
# Print results
|
||||
print("-------")
|
||||
print("Sockets opened: %s" % len(stats))
|
||||
print("Latency stats: Mean %.3fs Median %.3fs Stdev %.3f 95%% %.3fs 95%% %.3fs" % (
|
||||
latency_mean,
|
||||
latency_median,
|
||||
latency_stdev,
|
||||
latency_95,
|
||||
latency_99,
|
||||
))
|
||||
if latencies:
|
||||
print("Latency stats: Mean %.3fs Median %.3fs Stdev %.3f 95%% %.3fs 95%% %.3fs" % (
|
||||
latency_mean,
|
||||
latency_median,
|
||||
latency_stdev,
|
||||
latency_95,
|
||||
latency_99,
|
||||
))
|
||||
print("Good sockets: %s (%.2f%%)" % (num_good, (float(num_good) / len(stats))*100))
|
||||
print("Incomplete sockets: %s (%.2f%%)" % (num_incomplete, (float(num_incomplete) / len(stats))*100))
|
||||
print("Corrupt sockets: %s (%.2f%%)" % (num_corruption, (float(num_corruption) / len(stats))*100))
|
||||
|
|
|
@ -13,6 +13,6 @@ services:
|
|||
worker:
|
||||
image: channels-test
|
||||
build: .
|
||||
command: python manage.py runworker
|
||||
command: python manage.py runworker --settings=testproject.settings.channels_redis
|
||||
depends_on:
|
||||
- redis
|
||||
|
|
Loading…
Reference in New Issue
Block a user