Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/clinicjs/node-clinic-bubbleprof-demo
A Clinic Bubbleprof example
https://github.com/clinicjs/node-clinic-bubbleprof-demo
Last synced: about 2 months ago
JSON representation
A Clinic Bubbleprof example
- Host: GitHub
- URL: https://github.com/clinicjs/node-clinic-bubbleprof-demo
- Owner: clinicjs
- License: mit
- Created: 2018-05-25T10:54:29.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2020-08-21T19:49:06.000Z (over 4 years ago)
- Last Synced: 2024-05-28T14:05:53.835Z (7 months ago)
- Language: JavaScript
- Homepage: https://clinicjs.org/
- Size: 12.7 KB
- Stars: 14
- Watchers: 23
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Bubbleprof Example
This is an example of a small real world-ish program. It contains an import script (`import-npm.js`) that imports the npm registry metadata into a mongodb running on localhost and a series of servers showcasing problems and improvements.
The mongodb will contain two collections `slow` and `fast` which contain the same data, except `fast` will contain an index for doing fast lookups and `slow` will not.
If you have docker installed you can install and run a mongo container by doing.
## Run Mongo
```sh
docker pull mongodocker run -it -p 27017:27017 mongo
```## Alternative
Some platforms may give a Docker error and require the following command instead
```sh
docker pull mongodocker run -v $(pwd)/datadir:/data/db -p 27017:27017 -d mongo
```## Import Data
Then to import some data
```sh
# note you can just run this for a bit and kill it
npm install
node import-npm.js
```There are 4 iterations of a server that returns the 5 latest and 5 oldest updated modules on npm.
1. Returns the latest and oldest 5 modules from an _unindexed_ collection
1. Returns the latest and oldest 5 modules from an _indexed_ collection
1. Returns the same as `2` but does the queries in parallel.
1. Caches the result from `3` in 5s in an LRU cache.Each should produce different Bubbleprof results indicating the async profile of each. Running `1` you should see a ton of latency, running `2` you should see much more throughput, and running `3` you should see a few more branches in the async graph.
## Run Bubbleprof
To run the first one do:
```sh
clinic bubbleprof --autocannon [ -c 5 -a 500 / ] -- node 1-server-with-no-index.js
```