make
# default credentials: admin/admin
firefox http://localhost:3000
# Execute some requests and check the graphs
We can find the size of a database and table with the following SQL queries:
-- db size
SELECT pg_size_pretty(pg_database_size('benchmark'));
-- table size
SELECT pg_size_pretty(pg_total_relation_size('public.cat'));
-- schema size
SELECT schema_name,
pg_size_pretty(sum(table_size)::bigint) AS schema_size
FROM (
SELECT pg_catalog.pg_namespace.nspname as schema_name,
pg_total_relation_size(pg_catalog.pg_class.oid) as table_size
FROM pg_catalog.pg_class
JOIN pg_catalog.pg_namespace ON relnamespace = pg_catalog.pg_namespace.oid
) t
GROUP BY schema_name
ORDER BY schema_name;
We can have get the stats on SQL queries by activating the pg_stat_statements
on PostgreSQL and by executing the
following query:
SELECT query, calls, total_time, min_time, max_time, mean_time FROM pg_stat_statements ORDER BY mean_time DESC;
Spring Boot can integrate easily with micrometer, an amazing tool that provides out of the box instrumentation for JVM application and it addresses some of the common problems that we face while instrumenting and collecting metrics.
We will be using Prometheus to collect the metrics and visualize the metrics using Grafana.
VisualVM can been used to monitor the resources used of the application when the tests are being executed.
We can use Gatling to perform the HTTP requests.
make gatling
# This will generate an HTML report on target/gatling/catsimulation-*/index.html that you can see on your browser