Measurement method of Database in Go framework(Speed)

1. What is measure:

  • Measure: database driver, database connection pool.
  • Test Types:
    • Single Database Query : Exercises the framework’s object-relational mapper (ORM), random number generator, database driver, and database connection pool.
    • Multiple Database Queries : Multiple rows are fetched to more dramatically punish the database driver and connection pool. At the highest queries-per-request tested (20), this test demonstrates all frameworks’ convergence toward zero requests-per-second as database activity increases.
    • Database Updates: Exercises the ORM’s persistence of objects and the database driver’s performance at running UPDATE statements or similar. The spirit of this test is to exercise a variable number of read-then-write style database operations.

2. How to measure :

  • Single Database Query : Each request is processed by fetching a single row from a simple database table. That row is then serialized as a JSON response. The test is run at concurrency levels ranging from 16 to 512.

  • Multiple Database Queries : Each request is processed by fetching multiple rows from a simple database table and serializing these rows as a JSON response. The test is run multiple times: testing 1, 5, 10, 15, and 20 queries per request. All tests are run at 512 concurrency.

  • Database Updates: This test exercises database writes. Each request is processed by fetching multiple rows from a simple database table, converting the rows to in-memory objects, modifying one attribute of each object in memory, updating each associated row in the database individually, and then serializing the list of objects as a JSON response. The test is run multiple times: testing 1, 5, 10, 15, and 20 updates per request. Note that the number of statements per request is twice the number of updates since each update is paired with one query to fetch the object. All tests are run at 512 concurrency.

3. Result of measure DB:

  • Single Database Query:
    • Example : Request per second
Concurrency(user) 16 32 64 128 256 512
Framework
Beego 81124 81639 79588 77197 79011 79290
Gin 80012 87076 86404 88539 87384 83575
Echo 83519 92158 96203 99646 93767 84203
Revel 48061 63123 64495 64971 63659 61542

    • Example: Latency

Unit: millisecond

Concurrency(user) 16 32 64 128 256 512
Framework
Beego 0,4 0,8 1,2 2,2 3,8 7,3
Gin 0,4 0,6 1,1 1,8 3,4 6,5
Echo 0,3 0,5 0,9 1,6 2,9 6,1
Revel 1,6 1,5 2,1 3,6 7,6 19,3

  • Multiple Database Queries :
    • Example : Request per second

Unit: request/s

Queries 1 5 10 15 20
Framework
Beego 168394 47039 24914 16967 12757
Gin 177459 47261 24477 17007 12685
Echo 182944 45377 22496 15202 11375
Revel 114424 29904 15963 10905 8312

    • Example : Latency

Unit: millisecond

Queries 1 5 10 15 20
Framework
Beego 42 84 120 225 380
Gin 41 67 113 179 343
Echo 37 56 92 180 298
Revel 165 159 218 361 466

  • Database Updates:
    • Example: Number of request

Unit: request/s

Queries 1 5 10 15 20
Framework
Beego 168394 47039 23914 16967 12554
Gin 177459 55261 24477 19007 12769
Echo 192944 68377 26496 16202 13372
Revel 114424 35904 15963 12925 8364

    • Example: Latency

Unit: millisecond

Queries 1 5 10 15 20
Framework
Beego 42 84 122 225 379
Gin 32 62 113 179 356
Echo 37 77 92 199 301
Reve 86 135 218 283 432

Refer: techempower.com