Is there any tweaks / hints to optimize / fine-tune PostgreSQL for gvmd ? My installation has plenty of CPU / Memory available; but still gsad is often very slow to answer queries, and very often it fails to receive answers from gvmd due to time out.
Looking at the processes clearly show that postgresql daemons are taking most of the CPU power, but still this remains very low considering the global CPU power of the system. So clearly, it doesn’t seem optimized.
It seems that requesting the results is very very slow with Postgres 12 compared to Postgres 11. Postgres 11 is of course recommended because that’s the version in Debian Stable which is our reference system.
Hi Everyone and thanks for your interest in the subject.
A couple of informations:
System is bare metal with OS Linux Mint 19.3 64 bit (Ubuntu 18.04 LTS)
Installed version of PostgreSQL is 10. 94 Gb RAM and Intel® Xeon® CPU X5680 @ 3.33GHz 23 cores
As you use PSQL 10 and not 11 i would upgrade, and then trying to fine tune your database and looking into your system issues. Still you did not answer any questions regarding your storage.
I don´t see any native NVMEs that is what we use for accelerate in our enterprise appliances. They are 10 times faster then spinning rust if you have a huge database, that would kill your performance due to seek times.
As well your amount of swap is far to high, i would turn swap off with that amount of ram.
So classic debugging and performance optimization would be my next steps.
OK, I take the point of PSQL 11. Didn’t know this was the recommended version.
Regarding the storage, sorry I missed it. I’m not using NVMEs drives; currently only ATA. If you guys believe this would really improve things, then I’ll see how to invest in that.
Last point is SWAP; perhaps I’m wrong but I always thought that:
disabling SWAP is a bad idea
System will always use memory first, then swap if no more memory is available.
Does GVM-11 actually works with PostgreSQL-11, or were you only talking about GVM 20.08 ? On a pre-prod system I have updated my PSQL from 10 to 11, but then I get the following errors when starting gvmd:
md main:MESSAGE:2020-09-23 17h09.44 utc:9172: Greenbone Vulnerability Manager version 9.0.0 (DB revision 221)
md manage:MESSAGE:2020-09-23 17h09.44 utc:9173: check_db_versions: database version of SCAP database: 16
md manage:MESSAGE:2020-09-23 17h09.44 utc:9173: check_db_versions: SCAP database version supported by manager: 15
md main:CRITICAL:2020-09-23 17h09.44 utc:9173: gvmd: database is wrong version
I don’t really understand this error, as I don’t see how my SCAP database version could be newer than the one supported by the manager, since I havn’t actually changed the SCAP data during the PSQL upgrade.
For gvmd-20.08 and gvmd-21.04/master PostgreSQL 11 is our reference. The PostgreSQL 12 issue might get fixed but we can’t promise anything at the moment.
For other versions below gvmd-20.08 Debian Stretch is the base system and therefore PostgreSQL 9.6 is recommended.
For your current issue with the SCAP db, please try to use gvmd-9.0.1 the latest bugfix release instead of 9.0.0. I can remember either a ticket a GitHub or a topic in this forum where this issue was mentioned to and updating to the bugfix release fixed it.
Using GVM-11/gvmd-9 with PostgreSQL 11 should work. I’ve used that for a longer period on my personal development computer. But it isn’t tested and there is no guarantee because our corresponding products (GOS 5 and 6) are based on Debian Stretch and therefore PostgreSQL 9.6. We are developing and testing for our products of course. If the community is facing issues with other systems varying from our reference system we sometimes can’t give any promises for fixes.
Using GVM-11/gvmd-9 with PostgreSQL 11 does work, actually. It just that in our production environment, it is pain slow. Perhaps it has nothing to do with the version of PSQL. It’s possible gvmd is just not designed to handle such big database (57GB), that’s why I want to explore all options at this point.
I have seen DBs with more then 10 /8 networks and 16 millions of results.
But they are never at this size, do you store all “log” and “scan-meta” data there ?
How often do you do DB maintenance ?
It looks like a non optimal scan configuration and/or missing db-maintenance.
Plus our enterprise appliances designed for that type of DBs have a block-acceleration based on special hardware so speed up the DB in hardware.
Regarding the DB maintenance; I’m doing the following weekly:
Freeing some unused storage space in the database
/opt/gvm/sbin/gvmd --optimize=vacuum
Optimize DB queries
/opt/gvm/sbin/gvmd --optimize=analyze
Cleans up references to report formats that have been removed without using the DELETE_REPORT_FORMAT GMP command, for example after a built-in report format has been removed.
That is not enough with that DB size, as well your default config is not intended for that extra big enterprise environment. I would run offline optimizations first.
I would go with multiple enterprise appliances with that big environment. Otherwise you have to re-invent the wheel based on our OpenSource.
What do you call offline optimization ? Please share informations if you have it. Also you mention log data; is there a way to stop logging it ? I havn’t found any documentation on this; it only apply to reports.
The appliance is unfortunately not an option in my context; due to prohibitive restrictions to install hardwares in our DCs. And in all case, I understand my DB isn’t optimized since you said you’ve seen DBs with more than 10 /8 networks never reaching that size.
Currently I have no other option but to optimize to the maximum what I have. Again, help is welcome here if you have advices.