This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from 'react'; | |
| import Dropzone from 'react-dropzone'; | |
| class SnapshotUploader extends React.Component { | |
| onDrop = (acceptedFiles, rejectedFiles) => { | |
| acceptedFiles.forEach(file => console.log(file, 'accepted')); | |
| rejectedFiles.forEach(file => console.log(file, 'rejected')); | |
| } | |
| render() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #[get("/tasks")] | |
| pub async fn get_tasks( | |
| query: Query<GetTasksQuery>, db_pool: Data<Pool> | |
| ) -> Result<HttpResponse, BenchError> { | |
| let tasks = db::get_tasks(db_pool.into_inner(), query.into_inner()).await?; | |
| Ok(HttpResponse::Ok().json(tasks)) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CREATE TABLE worker ( | |
| id SERIAL PRIMARY KEY, | |
| name varchar(255) NOT NULL, | |
| email varchar(255) NULL, | |
| score integer DEFAULT 0 | |
| ); | |
| CREATE TABLE task ( | |
| id SERIAL PRIMARY KEY, | |
| summary varchar(255) NOT NULL, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| router.get('/tasks', (req, res, next) => { | |
| let { assignee_name, summary, limit, full } = req.query; | |
| full = full == "true"; | |
| if (!!limit && isNaN(limit)) { | |
| return next(createError({ | |
| status: 400, | |
| message: "limit query parameter should be a number" | |
| })); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| async function get_tasks(params, offset, res) { | |
| let conn = (params["full"] == "true") | |
| ? db.get_tasks_full() | |
| : db.get_tasks(); | |
| let { client, config } = await conn; | |
| let values = [ | |
| !!params["assignee_name"] ? `%${params["assignee_name"]}%` : null, | |
| !!params["summary"] ? `%${params["summary"]}%` : null, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Target | Concurrency | PSQL cpu | mem | Node cpu | mem | Actix cpu | mem | lat ms | rps | |
|---|---|---|---|---|---|---|---|---|---|---|
| node | 2 | 0.58 | 112 | 0.91 | 86 | 0.00 | 5 | 2.19 | 919 | |
| actix | 2 | 0.89 | 126 | 0.00 | 86 | 0.42 | 5 | 0.98 | 2022 | |
| node | 4 | 0.68 | 155 | 1.02 | 87 | 0.00 | 5 | 3.58 | 1123 | |
| actix | 4 | 2.01 | 183 | 0.00 | 87 | 0.80 | 5 | 0.88 | 4520 | |
| node | 8 | 0.76 | 242 | 1.02 | 87 | 0.00 | 5 | 6.51 | 1232 | |
| actix | 8 | 3.42 | 298 | 0.00 | 87 | 0.99 | 6 | 1.06 | 7525 | |
| node | 16 | 0.73 | 395 | 1.02 | 87 | 0.00 | 6 | 13.10 | 1221 | |
| actix | 16 | 3.89 | 469 | 0.00 | 87 | 1.00 | 6 | 1.98 | 8076 | |
| node | 32 | 0.75 | 498 | 1.02 | 86 | 0.00 | 6 | 23.83 | 1342 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Actix workers | Concurrency | PSQL cpu | mem | Actix cpu | mem | lat ms | rps | |
|---|---|---|---|---|---|---|---|---|
| 1 | 2 | 0.89 | 126 | 0.42 | 5 | 0.98 | 2022 | |
| 4 | 2 | 0.91 | 380 | 0.73 | 6 | 0.97 | 2042 | |
| 1 | 4 | 2.01 | 183 | 0.80 | 5 | 0.88 | 4520 | |
| 4 | 4 | 1.94 | 408 | 1.34 | 6 | 0.89 | 4432 | |
| 1 | 8 | 3.42 | 298 | 0.99 | 6 | 1.06 | 7525 | |
| 4 | 8 | 3.83 | 508 | 2.15 | 6 | 0.95 | 8300 | |
| 1 | 16 | 3.89 | 469 | 1.00 | 6 | 1.98 | 8076 | |
| 4 | 16 | 6.69 | 708 | 3.00 | 7 | 1.11 | 14257 | |
| 1 | 32 | 3.61 | 498 | 1.00 | 7 | 4.01 | 7963 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Target | Concurrency | PSQL cpu | mem | Node cpu | mem | Actix cpu | mem | lat ms | rps | |
|---|---|---|---|---|---|---|---|---|---|---|
| node | 2 | 1.89 | 2153 | 0.12 | 59 | 0.00 | 28 | 39.89 | 50 | |
| actix | 2 | 1.77 | 2153 | 0.00 | 68 | 0.20 | 28 | 5.77 | 346 | |
| node | 4 | 3.75 | 2363 | 0.20 | 70 | 0.00 | 28 | 42.20 | 94 | |
| actix | 4 | 3.62 | 2363 | 0.00 | 86 | 0.34 | 28 | 5.92 | 674 | |
| node | 8 | 7.59 | 2829 | 0.37 | 84 | 0.00 | 28 | 45.49 | 175 | |
| actix | 8 | 7.20 | 2828 | 0.00 | 87 | 0.58 | 28 | 6.12 | 1305 | |
| node | 16 | 14.63 | 3668 | 0.59 | 93 | 0.00 | 28 | 48.58 | 328 | |
| actix | 16 | 13.50 | 3668 | 0.00 | 88 | 0.88 | 29 | 6.43 | 2486 | |
| node | 32 | 14.62 | 3669 | 0.60 | 89 | 0.00 | 29 | 97.28 | 328 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| async function get_tasks(assignee_name, summary, limit, full) { | |
| let query = full ? query_get_tasks_full() : query_get_tasks(); | |
| if (!!assignee_name) { | |
| query.where("assignee.name", "LIKE", `%${assignee_name}%`) | |
| } | |
| if (!!summary) { | |
| query.where("summary", "LIKE", `%${summary}%`) | |
| } | |
| query.limit(limit || 10); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pub async fn get_tasks(pool: Arc<Pool>, query: GetTasksQuery) -> Result<Vec<Task>, BenchError> { | |
| let _stmt = query.get_statement(); | |
| let client = pool.get().await?; | |
| let stmt = client.prepare_typed(&_stmt, &[Type::VARCHAR, Type::VARCHAR, Type::OID]).await?; | |
| client.query( | |
| &stmt, | |
| &[ &like(query.assignee_name), &like(query.summary), &query.limit.or(Some(10)) ], | |
| ).await? |
OlderNewer