Skip to content

Commit

Permalink
Merge pull request #2 from moxious/v0.3.1
Browse files Browse the repository at this point in the history
V0.3.1
  • Loading branch information
moxious authored Mar 14, 2019
2 parents 71b4df5 + 2a10c69 commit 69ce345
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 34 deletions.
14 changes: 14 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ jobs:
- image: circleci/node:10-browsers-legacy
steps:
- checkout
- setup_remote_docker
- restore_cache:
name: Restore Yarn Package Cache
keys:
Expand All @@ -21,6 +22,19 @@ jobs:
- run:
name: test
command: yarn run test
- run:
name: Build Docker Container
command: docker build -t mdavidallen/graph-workload:latest -f Dockerfile .
- run:
name: Deploy to Docker Hub
command: |
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
if [ "${CIRCLE_BRANCH}" = "master" ]; then
echo "Pushing docker image"
docker push mdavidallen/graph-workload:latest
else
echo "Not deploying; not master branch."
fi
- store_artifacts:
path: test-results.xml
prefix: tests
Expand Down
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
9 changes: 5 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
FROM node:9-alpine
MAINTAINER David Allen <[email protected]>
COPY src /src
RUN cd src && npm install
RUN mkdir /app
COPY . /app
RUN cd app && npm install
ENV NEO4J_URI "bolt://localhost"
ENV NEO4J_USER "neo4j"
ENV NEO4J_PASSWORD "neo4j"
ENV CONCURRENCY "10"

WORKDIR /src
CMD ["node", "workload.js"]
WORKDIR /app
ENTRYPOINT ["/usr/local/bin/node", "/app/src/run-workload.js"]
73 changes: 45 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,57 @@ reads/writes to execute against a database, while keeping track of execution sta

You can run workloads timed (i.e. for 5,000 ms) or numbered (i.e. 5,000 runs).

# Running Stand-Alone
# Usage

```
yarn install
export NEO4J_USER=neo4j
export NEO4J_PASSWORD=supersecret
export NEO4J_URI=bolt+routing://my-cloud-host:7687
node src/index.js
Usage: run-workload.js -p password
[-a address]
[-u username]
[-n hits] how many total queries to run
[--ms milliseconds] how many milliseconds to test for
[--workload /path/to/workload.json] probability table spec
[--query CYPHER_QUERY] single cypher query to run
[--concurrency c] how many concurrent queries to run (default: 10)
[--checkpoint cn] how often to print results in milliseconds (default: 5000)
[--fail-fast] if specified, the work will stop after encountering one
failure.
You may only specify one of the options --n or --ms.
You may only specify one of the options --workload or --query
Options:
--help Show help [boolean]
--version Show version number [boolean]
-a address to connect to [default: "localhost"]
-u username [default: "neo4j"]
-p password [required]
-n number of hits on the database
--ms number of milliseconds to execute
--workload absolute path to JSON probability table/workload
--query Cypher query to run
--concurrency [default: 10]
--checkpoint [default: 5000]
Examples:
run-workload.js -a localhost -u neo4j -p Run 10 hits on the local database
secret -n 10
```

Alternatively, you can pass some arguments, like this:
# Run in Docker

```
export NEO4J_USER=neo4j
export NEO4J_PASSWORD=supersecret
export NEO4J_URI=bolt+routing://my-cloud-host:7687
Simply pass any arguments the command recognizes to the docker container.

node src/index.js --concurrency 10 --n 20 --workload /path/to/read-workload.json
```
docker run --tty --interactive mdavidallen/graph-workload:latest -a my-neo4j-host.com -u neo4j -p password 2>&1
```

This would run the read workload in batches of 20, with 10 concurrent queries.
# Running Stand-Alone from Source

```
yarn install
node src/run-workload.js -a localhost -u neo4j -p password
```

See the `workloads` directory for the format of the probability table.

Expand All @@ -54,23 +84,10 @@ yarn run test
# Building Graph Workloads as a Docker Container

```
docker build -t graph-workload:latest -f Dockerfile .
```

# Running

```
docker run \
-e "NEO4J_URI=bolt://foo-host/" \
-e "NEO4J_USER=neo4j" \
-e "NEO4J_PASSWORD=secret" \
-e "CONCURRENCY=10" \
graph-workload:latest
docker build -t mdavidallen/graph-workload:latest -f Dockerfile .
```

# Adjusting Workload

This is not that friendly or configurable from the outside yet. But essentially:
# Defining your own Custom Workload

- Stress tester has a number of 'read strategies' and 'write strategies'
- There is a probability table; the stress tester rolls random numbers and picks a strategy
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "graph-workload",
"version": "0.3.0",
"description": "",
"version": "0.3.1",
"description": "Tool for generating workloads running on Neo4j",
"main": "src/run-workload.js",
"scripts": {
"graph-workload": "node src/run-workload.js",
Expand Down

0 comments on commit 69ce345

Please sign in to comment.