Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jmank88 committed Apr 13, 2018
0 parents commit 277b9a9
Show file tree
Hide file tree
Showing 16 changed files with 1,416 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
@@ -0,0 +1,4 @@
/chainload
/tmp.txt
/vendor/
/keystore
17 changes: 17 additions & 0 deletions Dockerfile
@@ -0,0 +1,17 @@
# build stage
FROM golang:1.10-alpine AS build-env
RUN apk --no-cache add build-base git bzr mercurial gcc
ENV D=/go/src/github.com/gochain-io/chainload
# Uncomment once gochain repo is public
# RUN go get -u github.com/golang/dep/cmd/dep
# ADD Gopkg.* $D/
# RUN cd $D && dep ensure --vendor-only
ADD . $D
RUN cd $D && go build -o chainload && cp chainload /tmp/

# final stage
FROM alpine
RUN apk add --no-cache ca-certificates curl
WORKDIR /app
COPY --from=build-env /tmp/chainload /usr/local/bin
ENTRYPOINT ["chainload"]
153 changes: 153 additions & 0 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 43 additions & 0 deletions Gopkg.toml
@@ -0,0 +1,43 @@
# Gopkg.toml example
#
# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md
# for detailed Gopkg.toml documentation.
#
# required = ["github.com/user/thing/cmd/thing"]
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
#
# [[constraint]]
# name = "github.com/user/project"
# version = "1.0.0"
#
# [[constraint]]
# name = "github.com/user/project2"
# branch = "dev"
# source = "github.com/myfork/project2"
#
# [[override]]
# name = "github.com/x/y"
# version = "2.4.0"
#
# [prune]
# non-go = false
# go-tests = true
# unused-packages = true


[[constraint]]
name = "github.com/gochain-io/gochain"
version = "^2.0.22"

[[constraint]]
name = "github.com/pkg/errors"
version = "^0.8.0"

[prune]
go-tests = true
unused-packages = true
[[prune.project]]
name = "github.com/gochain-io/gochain"
go-tests = true
non-go = false
unused-packages = false
7 changes: 7 additions & 0 deletions Makefile
@@ -0,0 +1,7 @@
.PHONY: dep docker

dep:
dep ensure --vendor-only

docker:
docker build -t gochain/chainload .
59 changes: 59 additions & 0 deletions README.md
@@ -0,0 +1,59 @@
# chainload

`chainload` is a GoChain/Ethereum blockchain load generator.

## How to use

With at least one pre-existing (and sufficiently funded) account under
`keystore/`, simply executing `chainload` will fire 1 transaction per
second at `http://localhost:8545` with chain id `1234`. Reports are
logged every 30s, with pprof and various metrics are available via expvar.

The target url(s), transaction rate, chain id, and more can be set via
flags:

```
chainload --help
Usage of chainload:
-dur duration
duration to run - omit for unlimited
-gas uint
gas (default 200000)
-id uint
id (default 1234)
-pass string
passphrase to unlock accounts (default "#go@chain42")
-senders int
total number of concurrent senders/accounts - defaults to 1/10 of tps
-tps int
transactions per second (default 1)
-urls string
csv of urls (default "http://localhost:8545")
-v verbose logging
```

Example:

```
chainload -id 9876 -urls http://node1:8545,http://node2:8545 -tps 100 -senders 50 -dur 5m
```

## How it works

Accounts are managed locally under `keystore/`. Seeder accounts must
be pre-existing. One seeder is started per url, to continually re-claim
funds from other accounts, and to seed funds to senders. Senders may
reuse pre-existing accounts or create new ones. Senders continually send
txs to a set of receivers, while periodically cycling out the sender and
receiver addresses.

## Problems

At high volume, the error `Too many open files` may occur. This system
limit can be inspected via `ulimit -n`, and temporarily raised
via `ulimit -n <new limit>`. It can be permanently set in
`/etc/security/limits.conf` by adding a line like:
```
root soft nofile 100000
```

0 comments on commit 277b9a9

Please sign in to comment.