bttger/web-framework-benchmarks (0.1.0)

License: MIT

It defines the interface which every web framework has to implement. The endpoints are chosen so that they cover the performance of the routing, parsing (of request parameters) and serialization (of responses) as distinctly as possible.

This definition contains the mandatory response data in the description of properties.

getSerialized

Responses

Response samples

Content type
application/json
{
  • "message": "string"
}

getSerializedBig

Responses

Response samples

Content type
application/json
{
  • "family": "string",
  • "scientificClassification":
    {
    • "kingdom": "string",
    • "phylum": "string",
    • "class": "string",
    • "order": "string",
    • "superfamily": "string",
    • "classifier":
      {
      • "name": "string",
      • "born":
        {
        • "year": 0,
        • "month": "string",
        • "day": 0,
        • "city": "string",
        • "country": "string"
        },
      • "died":
        {
        • "year": 0,
        • "month": "string",
        • "day": 0,
        • "city": "string",
        • "country": "string"
        },
      • "publications":
        [
        • {
          • "year": 0,
          • "related": true,
          • "description": "string"
          }
        ]
      }
    }
}

getPlainText

Responses

Response samples

Content type
text/plain; charset=utf-8
Hello, World!

getQueryResult

The response has to confirm if an object with the queried properties is available.

path Parameters
userId
required
integer

300

offset
required
integer

10

query Parameters
model
required
string

Dozer

factor
required
string

ATX

length
required
integer

800

width
required
integer

800

allow
required
boolean

true

header Parameters
x-api-key
required
string

zb478fb3

x-session-id
required
string

jhg723bf

Responses

Response samples

Content type
application/json
{
  • "id": 0,
  • "foundAt": "string"
}

insertObject

Parses the transmitted object, serializes it with an additional id and creation timestamp and returns it.

Request Body schema: application/json

An object containing all information to create a new object.

name
string

Sample

Array of objects

Two address items

oldTown
boolean

true

Responses

Request samples

Content type
application/json
{
  • "name": "Sightseeing",
  • "addresses":
    [
    • {
      • "street": "Breite Straße",
      • "number": 89,
      • "city": "Lübeck"
      },
    • {
      • "street": "Breite Straße",
      • "number": 89,
      • "city": "Lübeck"
      }
    ],
  • "oldTown": true
}

Response samples

Content type
application/json
{
  • "id": 0,
  • "name": "string",
  • "addresses":
    [
    • {
      • "street": "string",
      • "number": 0,
      • "city": "string"
      }
    ],
  • "oldTown": true,
  • "createdAt": "string"
}

getCalculated

This endpoint actually does not benchmark the framework itself, but the ability of the language to take advantage of all available cores when running computationally intensive tasks. The goal is that one request does not block the whole application and to keep the latency as low as possible.

Some frameworks have that feature built-in and others require developers to implement it manually using the language's core libraries.

For the calculation of the fibonacci number we use the recursive implementation to increase the time complexity [O(2^N)]. It covers a realistic case of some backend computation, e.g. cryptographic functions. When tested on my machine, the 27th fibonacci number took roughly the same time to calculate as the verification of a password with the argon2i algorithm (time cost value set to 3, hash length of 32 bytes, salt length of 16 bytes).

Responses

Response samples

Content type
application/json
{
  • "fibonacci": 0
}