snipe-benchmark

1.0.0 • Public • Published

Snipe Benchmark

A standard benchmark for Minecraft name snipers/blockers.

Quick-Start

<API_BASE> is the base URL of the benchmark server. Currently you can use the public deployment at https://snipe-benchmark.herokuapp.com

<YOUR_ID> is a unique identifier used to identify your sniper. This can be anything, but "arceus-v1.0.0" or "ares-vIDFK" are good examples.

  1. Setup the benchmark for a given time. Timestamp should be in milliseconds since the UNIX epoch:

    POST /<YOUR_ID>

    {
        "time": <TIMESTAMP>
    }
  2. Copy your snipers code, changing the snipe request to GET <API_BASE>/<YOUR_ID>/snipe. The server will send back no response to minimize resource usage under heavy load, but it will log your request.

  3. Get your results from the server by requesting GET <API_BASE>/<YOUR_ID>. The server will send back a response like this:

{
  "time": <BENCHMARK_TIME>,
  "requests": <REQUEST_COUNT>,
  "result": {
    "delay": <SNIPE_DELAY>,
    "requests": {
      "start": <FIRST_REQUEST>,
      "early": <EARLY_REQUESTS>,
      "late": <LATE_REQUESTS>,
      "end": <LAST_REQUEST>,
      "rate": <REQUEST_RATE>
    }
  }
}

Example

Here's an example in Python:

import requests
from datetime import datetime, timedelta
import time

def benchmark():
    bench_time = datetime.now() + timedelta(seconds=20) # Benchmark in 20 seconds

    # Set up benchmark
    requests.post("https://snipe-benchmark.herokuapp.com/python-example-v1.0.0", json={
        "time": bench_time.timestamp() * 1000 # Get the timestamp and convert from seconds to milliseconds
    })

    # Wait for benchmark
    while datetime.now() < bench_time:
        time.sleep(0.1)

    # Send snipe request
    requests.get("https://snipe-benchmark.herokuapp.com/python-example-v1.0.0/snipe")

    # Get results object
    res = requests.get("https://snipe-benchmark.herokuapp.com/python-example-v1.0.0")

    print(res.json())

benchmark()

Running should return something like this:

{
  "time": 1597768684767.3691,
  "requests": 1,
  "result": {
    "delay": 374.630859375,
    "requests": {
      "start": 1597768685683.4823,
      "early": 0,
      "late": 1,
      "end": 1597768685683.4823,
      "rate": null // This would normally be the average requests / second, but we only sent one request
    }
  }
}

So we got a delay around 375 milliseconds, not too bad for 10 lines of Python (minified).

Contributing

Please feel free to fork and make a pull request. The code is quite simple and for now is contained in just one file, src/app.js.

Planned Features

  • [x] Quick-start guide
  • [x] More granular result data
  • [x] Request / second result
  • [ ] Deploy on AWS behind Cloudfront to better simulate the Mojang API
  • [ ] Sniper leaderboards + auth system to prevent sabotage

Readme

Keywords

none

Package Sidebar

Install

npm i snipe-benchmark

Weekly Downloads

2

Version

1.0.0

License

MIT

Unpacked Size

6.49 kB

Total Files

5

Last publish

Collaborators

  • aquild