diff --git a/doc/devel/Benchmarking.md b/doc/devel/Benchmarking.md index c7dc0bf2ed7eda757a2d05363fa2cdf5528b1c62..3e48dc4f08e023be625bfaeaa2d645e73b2a9345 100644 --- a/doc/devel/Benchmarking.md +++ b/doc/devel/Benchmarking.md @@ -1,4 +1,4 @@ -# Manual Java-Side Benchmarking # +# Manual Java-side benchmarking # Benchmarking can be done using the `TransactionBenchmark` class (in package `caosdb.server.database.misc`). @@ -12,14 +12,14 @@ Benchmarking can be done using the `TransactionBenchmark` class (in package - `Container.getTransactionBenchmark().addBenchmark()` - `Query.addBenchmark()` -# Miscellaneous Notes # +# Miscellaneous notes # Notes to self, details, etc. ## On method calling order and benchmarked events ## - `Transaction.execute()` :: Logs benchmarks for events like: - - `INIT` + - `INIT` :: The transaction's `init()` method. - `PRE_CHECK` - `CHECK` - `POST_CHECK` @@ -29,13 +29,42 @@ Notes to self, details, etc. calls, some levels deeper, `backend.transaction.....execute(<k extends BackendTransaction> t)` -> see next point - ... -- `backend.transaction.....execute(transaction)` :: This method is benchmarked - again, this is probably the deepest level of benchmarking. It finally calls +- `backend.transaction.[...].execute(transaction)` :: This method is benchmarked + again (via parent class `BackendTransaction`), this is probably the deepest + level of benchmarking currently (Benchmark is logged as + e.g. `<RetrieveFullEntity>...</>`). It finally calls `[MySQLTransaction].execute()`. -- `[MySQLTransaction].execute()` :: This is the deppest backend implementation +- `[MySQLTransaction].execute()` :: This is the deepest backend implementation part, it typically creates a prepared statement and executes it. - Currently not benchmarked separately: - Getting the actual implementation (probably fast?) - Preparing the SQL statement - Executing the SQL statement - Java-side caching + +## Server settings ## + +- To enable the SQL general logs, log into the SQL server and do: + ```sql +SET GLOBAL log_output = 'TABLE'; +SET GLOBAL general_log = 'ON'; +``` +- To enable transaction benchmarks and disable caching in the server, set these + server settings: +```conf +TRANSACTION_BENCHMARK_ENABLED=true +CACHE_DISABLE=true +``` +- Additionally, the server should be started via `make run-debug` (instead of + `make run-single`), otherwise the benchmarking will not be active. + +## Notable benchmarks and where to find them ## + +| Name | Where measured | What measured | +|--------------------------------------|----------------------------------------------|-------------------------------| +| `Retrieve.init` | transaction/Transaction.java#135 | transaction/Retrieve.java#48 | +| `Retrieve.transaction` | transaction/Transaction.java#174 | transaction/Retrieve.java#133 | +| `Retrieve.post_transaction` | transaction/Transaction.java#182 | transaction/Retrieve.java#77 | +| `EntityResource.httpGetInChildClass` | resource/transaction/EntityResource.java#118 | all except XML generation | +| `ExecuteQuery` | ? | ? | +| | | |