PostgreSQL: temBoard version 7.11 released with huge performance boost

Dalibo released temBoard version 7.11 on the 18.05.2022, which is quite an important release because it comes with a huge performance boost. Besides that, a lot of bugfixes went into this release as well. The most important changes in release 7.11 can be found on the temBoards documentation page.

https://temboard.readthedocs.io/en/v7/CHANGELOG/

[7.11]

  • Fix heap bloat probe.
  • Fix statements not purged.
  • Collect metrics by agent batch. Huge performance boost.
  • Log HTTP request response time.
  • Check agent key on registration.
  • docker: New tag 7 for stable branch.
  • docker: Reduce image size using multi-stage build.

Agent:

  • docker: Fix build.
  • docker: Properly stop container on failure.

[7.10]

  • Fix performances issues with monitoring.
  • Show runtime libpq version in logs and –version.
  • Authenticate with agent using both header and query arg. 8.0 will remove query arg auth.
  • Packages for bullseye for both UI and agent.
  • Drop jessie package.
  • Always set application_name.

Server:

  • Fix database ownership on creation.
  • Fix first collector run failure on new agent.
  • Fix tracebacks when an agent is down.
  • Fix ‘null’ instance comment with auto register.
  • Ship a /usr/share/temboard/sql/reassign.sql script to fix ownership.
  • Define a shell to temboard UNIX user.
  • Review defaults temBoard user groups.
  • Optionnal performance tracing in temBoard UI logs.
  • Moving to Python3 on stretch, buster and bullseye.
  • Drop another tooltip breaking dropdown menu.
  • Monitoring: Time SQL queries for archive and aggregation.
  • systemctl reload temboard now reload temBoard configuration.

Agent:

  • Fix database probes always executed on same database.
  • Reduce reconnexion in monitoring probes.
  • Explicitily requires psycopg2 2.7+ on debian.
  • Ignore loopback and tmpfs file systems.
  • Drop Python2 support
  • Build RHEL8 package with RockyLinux 8.

In case you are interested in the complete list of changes between version 7.9 and 7.11 I would recommended to use the Github compare.

https://github.com/dalibo/temboard/compare/7.9…7.11

The latest version for Red Hat/CentOS 7.x can be found here:

https://yum.dalibo.org/labs/CentOS7-x86_64/

temboard-7.11-1.el7.noarch.rpm
temboard-agent-7.11-1.el7.noarch.rpm

Fortunately, the upgrade from 7.9 to 7.11 is quite simply. In general, you need only to stop the service, upgrade the rpm package, run the temboard-migratedb script and start the service again.

Stop the temBoard server and agent and start with a clean log file.

$ sudo systemctl stop temboard.service
$ sudo systemctl stop temboard-agent@12-pg58888.service
$ sudo systemctl reset-failed
$ sudo systemctl is-system-running
running

$ cd /var/log/temboard/
$ sudo mv temboard.log temboard.log.before_upgrade_to_7.11
$

Upgrade the temBoard (UI) to 7.11

$ sudo yum localupdate temboard-7.11-1.el7.noarch.rpm
Loaded plugins: enabled_repos_upload, langpacks, package_upload, product-id, search-disabled-repos, subscription-manager
Examining temboard-7.11-1.el7.noarch.rpm: temboard-7.11-1.el7.noarch
Marking temboard-7.11-1.el7.noarch.rpm as an update to temboard-7.10-1.el7.noarch
Resolving Dependencies
--> Running transaction check
---> Package temboard.noarch 0:7.10-1.el7 will be updated
---> Package temboard.noarch 0:7.11-1.el7 will be an update
--> Finished Dependency Resolution
rhel-7-server-extras-rpms/x86_64                                                                                        | 2.0 kB  00:00:00
rhel-7-server-optional-rpms/x86_64                                                                                      | 2.0 kB  00:00:00
rhel-7-server-rh-common-rpms/x86_64                                                                                     | 2.1 kB  00:00:00
rhel-7-server-rpms/x86_64                                                                                               | 2.0 kB  00:00:00
rhel-7-server-satellite-tools-6.9-rpms/x86_64                                                                           | 2.1 kB  00:00:00
rhel-7-server-supplementary-rpms/x86_64                                                                                 | 2.3 kB  00:00:00
rhel-server-rhscl-7-rpms/x86_64                                                                                         | 2.3 kB  00:00:00

Dependencies Resolved

===============================================================================================================================================
 Package                      Arch                       Version                         Repository                                       Size
===============================================================================================================================================
Updating:
 temboard                     noarch                     7.11-1.el7                      /temboard-7.11-1.el7.noarch                     3.9 M

Transaction Summary
===============================================================================================================================================
Upgrade  1 Package

Total size: 3.9 M
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : temboard-7.11-1.el7.noarch                                                                                                  1/2
  Cleanup    : temboard-7.10-1.el7.noarch                                                                                                  2/2
Uploading Package Profile
Loaded plugins: langpacks, product-id, subscription-manager
  Verifying  : temboard-7.11-1.el7.noarch                                                                                                  1/2
  Verifying  : temboard-7.10-1.el7.noarch                                                                                                  2/2

Updated:
  temboard.noarch 0:7.11-1.el7

Complete!
Uploading Enabled Repositories Report
Loaded plugins: langpacks, product-id, subscription-manager


Check if the new version is correct.

[sourcecode language="plain"]
$ temboard --version
 INFO: Starting temboard 7.11.
temBoard 7.11
System Red Hat Enterprise Linux Server 7.9 (Maipo)
Python 2.7.5 (/usr/bin/python)
Tornado 4.2.1
psycopg2 2.5.1 (dt dec pq3 ext)
libpq 9.2.24
SQLAlchemy 0.9.8
alembic 0.8.3

Upgrade the temBoard agent.

$ sudo yum localupdate temboard-agent-7.11-1.el7.noarch.rpm
Loaded plugins: enabled_repos_upload, langpacks, package_upload, product-id, search-disabled-repos, subscription-manager
Examining temboard-agent-7.11-1.el7.noarch.rpm: temboard-agent-7.11-1.el7.noarch
Marking temboard-agent-7.11-1.el7.noarch.rpm as an update to temboard-agent-7.10-1.el7.noarch
Resolving Dependencies
--> Running transaction check
---> Package temboard-agent.noarch 0:7.10-1.el7 will be updated
---> Package temboard-agent.noarch 0:7.11-1.el7 will be an update
--> Finished Dependency Resolution
rhel-7-server-extras-rpms/x86_64                                                                                        | 2.0 kB  00:00:00
rhel-7-server-optional-rpms/x86_64                                                                                      | 2.0 kB  00:00:00
rhel-7-server-rh-common-rpms/x86_64                                                                                     | 2.1 kB  00:00:00
rhel-7-server-rpms/x86_64                                                                                               | 2.0 kB  00:00:00
rhel-7-server-satellite-tools-6.9-rpms/x86_64                                                                           | 2.1 kB  00:00:00
rhel-7-server-supplementary-rpms/x86_64                                                                                 | 2.3 kB  00:00:00
rhel-server-rhscl-7-rpms/x86_64                                                                                         | 2.3 kB  00:00:00

Dependencies Resolved

===============================================================================================================================================
 Package                         Arch                    Version                      Repository                                          Size
===============================================================================================================================================
Updating:
 temboard-agent                  noarch                  7.11-1.el7                   /temboard-agent-7.11-1.el7.noarch                  900 k

Transaction Summary
===============================================================================================================================================
Upgrade  1 Package

Total size: 900 k
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : temboard-agent-7.11-1.el7.noarch                                                                                            1/2
No units found for temboard-agent.
Too few arguments.
  Cleanup    : temboard-agent-7.10-1.el7.noarch                                                                                            2/2
Uploading Package Profile
Loaded plugins: langpacks, product-id, subscription-manager
  Verifying  : temboard-agent-7.11-1.el7.noarch                                                                                            1/2
  Verifying  : temboard-agent-7.10-1.el7.noarch                                                                                            2/2

Updated:
  temboard-agent.noarch 0:7.11-1.el7

Complete!
Uploading Enabled Repositories Report
Loaded plugins: langpacks, product-id, subscription-manager

Check if the new agent version is correct.

$ temboard-agent --version
 INFO: Starting temboard-agent 7.11.
temBoard agent 7.11
System Red Hat Enterprise Linux Server 7.9 (Maipo)
Python 3.6.8 (/usr/bin/python3)
psycopg2 2.7.7 (dt dec pq3 ext) libpq 9.2.24

Now run the database upgrade as the temboard OS user.

$ su - temboard
Password:
Last login: Wed Feb 23 08:13:38 CET 2022 on pts/1

$ temboard-migratedb upgrade
 INFO: Starting temboard-migratedb 7.11.
 INFO: Found config file /etc/temboard/temboard.conf.
 INFO: Running on Red Hat Enterprise Linux Server 7.9 (Maipo).
 INFO: Using Python 2.7.5 (/usr/bin/python) and Tornado 4.2.1.
 INFO: Using libpq 9.2.24, Psycopg2 2.5.1 (dt dec pq3 ext) and SQLAlchemy 0.9.8.
 INFO: Context impl PostgresqlImpl.
 INFO: Will assume transactional DDL.
 INFO: Database up to date.

$

You might will notice that a few entries in the PostgreSQL repository database.

2022-05-19 10:35:10.546 CEST [28573] LOG:  statement: CREATE SCHEMA IF NOT EXISTS "application";
2022-05-19 10:35:10.548 CEST [28573] LOG:  statement: ALTER TABLE public.alembic_version SET SCHEMA "application";
2022-05-19 10:35:10.549 CEST [28573] ERROR:  relation "public.alembic_version" does not exist
2022-05-19 10:35:10.549 CEST [28573] STATEMENT:  ALTER TABLE public.alembic_version SET SCHEMA "application";
2022-05-19 10:35:45.947 CEST [2136] LOG:  checkpoint starting: time

Add the Environment to the service file of tembaord server and agent.

Environment="LD_LIBRARY_PATH=/app/lib/postgres/pgproduct/pg-12.10/lib"
$ sudo vi temboard-agent@12-pg58888.service
$ sudo vi temboard.service
$ cat temboard-agent@12-pg58888.service
[Unit]
Description=PostgreSQL Remote Control Agent %I
After=network.target postgresql@%i.service
AssertPathExists=/etc/temboard-agent/%I/temboard-agent.conf

[Service]
Type=simple
User=postgres
Group=postgres
Environment="LD_LIBRARY_PATH=/app/lib/postgres/pgproduct/pg-12.10/lib"
ExecStart=/usr/bin/env SYSTEMD=1 temboard-agent -c /etc/temboard-agent/%I/temboard-agent.conf

[Install]
WantedBy=multi-user.target


$ cat temboard.service
[Unit]
Description=temBoard Web UI
After=network.target

[Service]
Type=simple
User=temboard
Group=temboard
Environment="LD_LIBRARY_PATH=/app/lib/postgres/pgproduct/pg-12.10/lib"
ExecStart=/usr/bin/env SYSTEMD=1 temboard -c /etc/temboard/temboard.conf
ExecReload=kill -HUP $MAINPID

[Install]
WantedBy=multi-user.target


$ sudo systemctl daemon-reload
$ sudo systemctl reset-failed
$ sudo systemctl is-system-running
running

I usually adjust the temboard service as well with the nice value of -19. (Nice=-19). This is an optional step and not mandatory. I do it only to give the temBoard service the highest CPU priority.

$ cd /etc/systemd/system/temboard.service.d/
$ cat override.conf
[Service]
Nice=-19
#Environment=PERF=y

Startup the temBoard UI and the agent.

$ sudo systemctl daemon-reload
$ sudo systemctl start temboard.service
$ sudo systemctl start temboard-agent@12-pg58888.service

Check if the services are running correctly.


$ sudo systemctl status temboard.service
● temboard.service - temBoard Web UI
   Loaded: loaded (/usr/lib/systemd/system/temboard.service; enabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/temboard.service.d
           └─override.conf
   Active: active (running) since Thu 2022-05-19 10:43:25 CEST; 36s ago
 Main PID: 14459 (temboard)
   CGroup: /system.slice/temboard.service
           ├─14459 temboard: web
           ├─14467 temboard: worker pool
           ├─14468 temboard: scheduler
           ├─14480 temboard: task temboardui.plugins.statements.statements_purge_wo
           ├─14482 temboard: task temboardui.plugins.statements.pull_data_worker
           ├─14495 temboard: task temboardui.plugins.monitoring.collector_batch
           ├─14496 temboard: task temboardui.plugins.monitoring.collector_batch
           ├─14497 temboard: task temboardui.plugins.monitoring.collector_batch
           ├─14498 temboard: task temboardui.plugins.monitoring.collector_batch
           ├─14499 temboard: task temboardui.plugins.monitoring.collector_batch
           ├─14500 temboard: task temboardui.plugins.monitoring.collector_batch
           ├─14501 temboard: task temboardui.plugins.monitoring.collector_batch
           ├─14505 temboard: task temboardui.plugins.monitoring.collector_batch
           ├─14509 temboard: task temboardui.plugins.monitoring.collector_batch
           ├─14517 temboard: task temboardui.plugins.monitoring.collector_batch
           ├─14519 temboard: task temboardui.plugins.monitoring.collector_batch
           ├─14524 temboard: task temboardui.plugins.monitoring.collector_batch
           ├─14525 temboard: task temboardui.plugins.monitoring.collector_batch
           ├─14528 temboard: task temboardui.plugins.monitoring.collector_batch
           ├─14529 temboard: task temboardui.plugins.monitoring.collector_batch
           ├─14530 temboard: task temboardui.plugins.monitoring.collector_batch
           └─15668 temboard: task temboardui.plugins.monitoring.notify_state_change




$ sudo systemctl status temboard-agent@12-pg58888.service
● temboard-agent@12-pg58888.service - PostgreSQL Remote Control Agent 12/pg58888
   Loaded: loaded (/usr/lib/systemd/system/temboard-agent@.service; enabled; vendor preset: disabled)
   Active: active (running) since Thu 2022-05-19 10:43:41 CEST; 37s ago
 Main PID: 14905 (temboard-agent)
   CGroup: /system.slice/system-temboard\x2dagent.slice/temboard-agent@12-pg58888.service
           ├─14905 temboard-agent: 12/pg58888: main process
           ├─14932 temboard-agent: 12/pg58888: worker pool
           └─14933 temboard-agent: 12/pg58888: scheduler

May 19 10:43:41 host01 systemd[1]: Started PostgreSQL Remote Control Agent 12/pg58888.
May 19 10:43:41 host01 env[14905]: INFO: Starting temboard-agent 7.11.
May 19 10:43:41 host01 env[14905]: INFO: Running on Red Hat Enterprise Linux Server 7.9 (Maipo).
May 19 10:43:41 host01 env[14905]: INFO: Using Python 3.6.8 (/usr/bin/python3).
May 19 10:43:41 host01 env[14905]: INFO: Using libpq 12.10, Psycopg2 2.7.7 (dt dec pq3 ext).

Ready 🙂

Conclusion

The temBoard 7.11 is very important new release which comes with a lot of bug fixes and huge performance benefits.