Skip to content

Commit

Permalink
Benchmark script + README update
Browse files Browse the repository at this point in the history
  • Loading branch information
gzigzigzeo committed Sep 11, 2018
1 parent c3e2f7a commit 2cf0358
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,10 @@ Settings:
* `DEBUG_LEDGER` - start ingest from specific ledger (debug purposes).
* `INGEST_INTERVAL` - poll db every ms (2000 by default), useful while debugging.

# Benchmark

We have not done full stress test yet. Besides that, it looks like server run on MBP mid 14 with 16GB RAM survives approx 7k concurrent connections with no losses. Check [benchmark script](benchmark/index.ts) for details.

# Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/mobius-network/astrograph. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
Expand Down
10 changes: 7 additions & 3 deletions benchmark/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Run with: yarn bench

import ws from "ws";
import { WebSocketLink } from "apollo-link-ws";
import { SubscriptionClient } from "subscriptions-transport-ws";
Expand Down Expand Up @@ -32,7 +34,9 @@ const SUBSCRIPTION = gql`

client.onError((error) => console.log("An error occured!", error.target));

for (let n = 0; n < 10000; n++) {
let eventCount = 0;

for (let n = 0; n < 7000; n++) {
apolloClient.subscribe({
fetchPolicy: "network-only",
query: SUBSCRIPTION,
Expand All @@ -41,9 +45,9 @@ for (let n = 0; n < 10000; n++) {
}
}).subscribe({
next (data: any) {
console.log(data.data.account.id);
eventCount += 1;
}
});
}

setTimeout(() => { console.log("Finished."); }, 20000);
setTimeout(() => { console.log("Finished.", eventCount, "events received."); }, 10000);

0 comments on commit 2cf0358

Please sign in to comment.