|
1 | | -# [veb](https://modules.vlang.io/veb.html) Benchmarking Test |
| 1 | +# V lang example web server |
2 | 2 |
|
3 | | -Veb is the default V language web framework. This test uses veb and V native ORM. |
| 3 | +Server "competition" *Web Framework Benchmarks*: https://www.techempower.com/benchmarks |
4 | 4 |
|
5 | | -### Test Type Implementation Source Code |
| 5 | +It designed to demonstrate how to use <a href="https://modules.vlang.io/veb.html">Veb</a>'s built-in features to create a web application. It's a slightly more complex example due to the fact i tried to reuse code for multiple scenarios. |
6 | 6 |
|
7 | | -All tests in a 95 lines [main.v] and a html [template](fortunes.html) |
8 | | -### Database |
| 7 | +> NOTE: Cache test still to be properly implemented |
9 | 8 |
|
10 | | -PostgresQL |
| 9 | +## Scenarios |
11 | 10 |
|
12 | | -## Test URLs |
13 | | -### JSON |
| 11 | +We created some scenarios. One on each folder. All scenarios use **Veb** server, the <a href="https://vlang.io">V</a> lang built-in web framework. |
14 | 12 |
|
15 | | -http://localhost:8080/json |
| 13 | +Scenario | Run locally | Run inside Benchmark |
| 14 | + --- | --- | --- |
| 15 | +Veb with Postgres | `db_host="127.0.0.1" v run veb-pg/` | `./tfb --mode veb` |
| 16 | +Veb with Postgres and ORM | `db_host="127.0.0.1" v run veb-pg-orm/` | `./tfb --mode veb-pg-orm` |
| 17 | +Veb with MySQL/MariaDB | `db_host="127.0.0.1" v run veb-my/` | `./tfb --mode veb-my` |
| 18 | +Veb with MySQL/MariaDB and ORM | `db_host="127.0.0.1" v run veb-my-orm/` | `./tfb --mode veb-my-orm` |
| 19 | +Veb with Postgres (Optimized) | `db_host="127.0.0.1" v run veb-pg/` | `./tfb --mode veb-pg-optimized` |
| 20 | +Veb with Postgres (Compilation flags) | `db_host="127.0.0.1" v run veb-pg/` | `./tfb --mode veb-compilation` |
16 | 21 |
|
17 | | -### PLAINTEXT |
| 22 | +## Local Setup |
18 | 23 |
|
19 | | -http://localhost:8080/plaintext |
| 24 | +in order to test the servers locally, you will need a database server and a database client. using container, you can use: |
20 | 25 |
|
21 | | -### DB |
| 26 | +### Postgres: |
22 | 27 |
|
23 | | -http://localhost:8080/db |
| 28 | +``` |
| 29 | +docker run --name benckmark-postgres \ |
| 30 | + -e POSTGRES_USER=benchmarkdbuser \ |
| 31 | + -e POSTGRES_PASSWORD=benchmarkdbpass \ |
| 32 | + -e POSTGRES_DB=hello_world \ |
| 33 | + -p 5432:5432 \ |
| 34 | + -d techempower/postgres:latest |
| 35 | +``` |
24 | 36 |
|
25 | | -### QUERY |
| 37 | +### MySQL/MariaDB: |
26 | 38 |
|
27 | | -http://localhost:8080/query?q= |
| 39 | +``` |
| 40 | +docker run --name benckmark-mysql \ |
| 41 | + -e MYSQL_ROOT_PASSWORD=benchmarkdbpass \ |
| 42 | + -e MYSQL_USER=benchmarkdbuser \ |
| 43 | + -e MYSQL_PASSWORD=benchmarkdbpass \ |
| 44 | + -e MYSQL_DATABASE=hello_world \ |
| 45 | + -p 3306:3306 \ |
| 46 | + -d techempower/mysql:latest |
| 47 | +``` |
28 | 48 |
|
29 | | -### UPDATE |
| 49 | +--- |
30 | 50 |
|
31 | | -http://localhost:8080/update?queries= |
32 | | - |
33 | | -### FORTUNES |
34 | | - |
35 | | -http://localhost:8080/fortunes |
| 51 | +Created by Bruno Massa |
0 commit comments