High DB usage

Current Development version likely to have breaking changes
Post Reply
dougmccrary
Posts: 1322
Joined: Sat Aug 31, 2019 7:35 am
Location: San Diego

High DB usage

Post by dougmccrary »

42A35A86-4991-4E48-A18E-5B242B324648.png
42A35A86-4991-4E48-A18E-5B242B324648.png (88.25 KiB) Viewed 10460 times
dougmccrary
Posts: 1322
Joined: Sat Aug 31, 2019 7:35 am
Location: San Diego

Re: High DB usage

Post by dougmccrary »

just got 1.37.1~20211016164753-focal.
Usage stayed high, do did a reboot. Mariadb took 10 minutes to stop.
So far, so good.
Thanks, Isaac!
User avatar
iconnor
Posts: 3197
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: High DB usage

Post by iconnor »

I wish someone with bootstrap or css skills would take some time and fixup our layout... I can do it, there is just too much to do though.

Anyways... you can bump up your db limits.... what is underlying your db, spinning rust or ssd? I've been finding that a lagging db due to spinning rust can really bog down ZM. I'm going to have to further optimise db accesses. Only so much I can do though.
dougmccrary
Posts: 1322
Joined: Sat Aug 31, 2019 7:35 am
Location: San Diego

Re: High DB usage

Post by dougmccrary »

It's on the same (type) 120mb ssd that was using maybe 30 or so two revisions back, and a TB disk. This seems to settle down around 60-70, or more if there's a lot of motion going on.
Up until a crash a week or so ago, I was on mySQL, but I went with MariaDB per you saying it was faster,
Maybe I should go back to mysql to see if it matters?
User avatar
iconnor
Posts: 3197
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: High DB usage

Post by iconnor »

For the db connection count to be that high, there has to be that many zm processes accessing it. In 1.34, there was a zmc and a zma for each monitor. Now we just have zmc, so the number should be half of what it was in 1.34.

ps ax | grep zm

how many processes? I wonder if you have the zmu hanging around issue?
dougmccrary
Posts: 1322
Joined: Sat Aug 31, 2019 7:35 am
Location: San Diego

Re: High DB usage

Post by dougmccrary »

There were about 67 connects, according to the web interface, when I got:

Code: Select all

doug@doug-System-ZMX:~$ ps ax | grep zm
   1093 ?        S      0:50 /usr/bin/perl -wT /usr/bin/zmdc.pl startup
   1404 ?        S      1:20 /usr/bin/perl -wT /usr/bin/zmwatch.pl
   1430 ?        S      0:00 /usr/bin/perl -wT /usr/bin/zmupdate.pl -c
   1447 ?        S      0:02 /usr/bin/perl -wT /usr/bin/zmstats.pl
  22683 ?        SLl  453:51 /usr/bin/zmc -m 9
  23807 ?        SLl  111:05 /usr/bin/zmc -m 3
  24033 ?        SLl   88:31 /usr/bin/zmc -m 13
  24048 ?        SLl  446:08 /usr/bin/zmc -m 11
  24054 ?        SLl  421:46 /usr/bin/zmc -m 10
  24055 ?        SLl  113:13 /usr/bin/zmc -m 1
  24161 ?        SLl  108:16 /usr/bin/zmc -m 8
  24175 ?        SLl  107:24 /usr/bin/zmc -m 2
  24198 ?        SLl   76:27 /usr/bin/zmc -m 4
  24210 ?        SLl  122:03 /usr/bin/zmc -m 14
  24226 ?        SLl  119:47 /usr/bin/zmc -m 15
  36792 ?        SLl  103:05 /usr/bin/zmc -m 5
  36917 ?        SLl  292:20 /usr/bin/zmc -m 7
  58748 ?        S      0:00 /usr/bin/perl -wT /usr/bin/zmtelemetry.pl
  58751 ?        S      0:03 /usr/bin/perl -wT /usr/bin/zmfilter.pl --filter_id=1 --daemon
  58752 ?        S      8:52 /usr/bin/perl -wT /usr/bin/zmfilter.pl --filter_id=3 --daemon
  58757 ?        S      0:04 /usr/bin/perl -wT /usr/bin/zmfilter.pl --filter_id=2 --daemon
  58831 ?        SLl   21:29 /usr/lib/zoneminder/cgi-bin/nph-zms
  59362 ?        SLl   14:35 /usr/lib/zoneminder/cgi-bin/nph-zms
  59386 ?        SLl   21:48 /usr/lib/zoneminder/cgi-bin/nph-zms
  59395 ?        SLl   11:16 /usr/lib/zoneminder/cgi-bin/nph-zms
  59397 ?        SLl   10:56 /usr/lib/zoneminder/cgi-bin/nph-zms
  60960 ?        SLl    2:08 /usr/lib/zoneminder/cgi-bin/nph-zms
  61827 ?        SLl   20:14 /usr/lib/zoneminder/cgi-bin/nph-zms
  65449 ?        SLl    5:46 /usr/lib/zoneminder/cgi-bin/nph-zms
  69407 ?        SLl    4:20 /usr/lib/zoneminder/cgi-bin/nph-zms
  69786 ?        SLl    1:37 /usr/lib/zoneminder/cgi-bin/nph-zms
  70281 ?        SLl    2:28 /usr/bin/zmc -m 6
  70315 ?        SLl    0:54 /usr/lib/zoneminder/cgi-bin/nph-zms
  71204 ?        SLl    0:12 /usr/lib/zoneminder/cgi-bin/nph-zms
  71206 ?        SLl    0:05 /usr/lib/zoneminder/cgi-bin/nph-zms
  71207 ?        SLl    0:06 /usr/lib/zoneminder/cgi-bin/nph-zms
  71209 ?        SLl    0:02 /usr/lib/zoneminder/cgi-bin/nph-zms
  71211 ?        SLl    0:05 /usr/lib/zoneminder/cgi-bin/nph-zms
  71212 ?        SLl    0:04 /usr/lib/zoneminder/cgi-bin/nph-zms
  71213 ?        SLl    0:10 /usr/lib/zoneminder/cgi-bin/nph-zms
  71214 ?        SLl    0:25 /usr/lib/zoneminder/cgi-bin/nph-zms
  71215 ?        SLl    0:04 /usr/lib/zoneminder/cgi-bin/nph-zms
  71216 ?        SLl    0:11 /usr/lib/zoneminder/cgi-bin/nph-zms
  71217 ?        SLl    0:05 /usr/lib/zoneminder/cgi-bin/nph-zms
  71218 ?        SLl    0:05 /usr/lib/zoneminder/cgi-bin/nph-zms
  71219 ?        RLl    0:11 /usr/lib/zoneminder/cgi-bin/nph-zms
  72221 ?        SLl    0:00 /usr/lib/zoneminder/cgi-bin/nph-zms
  72227 pts/0    S+     0:00 grep --color=auto zm
doug@doug-System-ZMX:~$ 
Magic919
Posts: 1381
Joined: Wed Sep 18, 2013 6:56 am

Re: High DB usage

Post by Magic919 »

Do you have a lot of watching clients/monitors? My nph-zms processes go up as I fire up ZMNinja or other clients. They drop back down again quickly on 1.36.8.

If not, they must be hanging around when not needed.
-
dougmccrary
Posts: 1322
Joined: Sat Aug 31, 2019 7:35 am
Location: San Diego

Re: High DB usage

Post by dougmccrary »

I have 14 assorted rtsp cams in mocord. 3 decode for timestamp, the rest passthrough, with jpegs either disabled or analysis only.
The same setup uses 20-30 DB on 1.36.8

Update:
For reasons I do not understand, 1.36.9 and 1.37.1 latest are now running almost neck and neck at 45-50 DB although the latter tends to run around 5 or so higher than 1.36. Both systems use the same settings and cameras, AFAIK.
Memory and swap nee /dev/shm is a nice change, BTW.
Post Reply