Page 2 of 3

Posted: Sun Sep 12, 2010 6:16 am
by bobbozzo
knnniggett wrote:The following is one example, specific to Zoneminder, of what dcommander is saying. Find the line in your /etc/init.d/zm script that says "$command start" and place the following just prior to that.

For 64 bit systems:

Code: Select all

export LD_LIBRARY_PATH=/opt/libjpeg-turbo/lib64:$LD_LIBRARY_PATH
For 32 bit systems:

Code: Select all

export LD_LIBRARY_PATH=/opt/libjpeg-turbo/lib:$LD_LIBRARY_PATH

Hi, this isn't helping for me...
I'm running Fedora 12 on a Pentium4 with HT, SSE, & SSE2.

I installed the libjpeg-turbo rpm, and the libs are in /opt/libjpeg-turbo/lib and the tests for libjpeg-turbo work and are much faster (I used some large images linked from the site).

However, ZoneMinder is no faster with
export LD_LIBRARY_PATH=/opt/libjpeg-turbo/lib:$LD_LIBRARY_PATH
before
$command start

when restarting ZM with
service zoneminder restart


Am I missing something?

Thanks,
Bob

Posted: Sun Sep 12, 2010 8:55 am
by Flasheart
After changing my four zm servers over, here are some Debian 32-bit instructions:

(Major load differences noticable. 1.46 to 0.34, 2.5 to 1.6, 3.16 to 2.0 and similar. This IS worth doing!)

Code: Select all

1. Visit http://sourceforge.net/projects/libjpeg-turbo/files/ and grab the latest .deb version. 

2. As root; dpkg -i libjpeg-turbo_1.0.1_i386.deb
This installs the package. 

3. Edit /etc/init.d/zoneminder
Add this line AFTER "ZM_PATH_BIN="/usr/bin""
export LD_LIBRARY_PATH=/opt/libjpeg-turbo/lib:$LD_LIBRARY_PATH 

4. Still as root, run: /etc/init.d/zoneminder restart


Job done. Once zm has restarted and settled down, you should see a significant reduction in load. Look at some live streams and recent recordings to verify all is working.

Posted: Sun Sep 12, 2010 10:02 am
by bobbozzo
Hi, thanks for the tip... unfortunately the RedHat init script is quite different.

I've decided to put the LD_LIBRARY_PATH setting in /etc/profile... it seems to be helping; the modect CPU usage is about the same, but recording is working MUCH better.

Thanks,
Bob

Posted: Mon Sep 13, 2010 9:48 am
by Flash_
Some munin graphs of system load. Change to libjpg-turbo happened on the 12th from the standard debian libs.

Image

Image

Image

Posted: Thu Oct 14, 2010 3:15 pm
by Pada
How do I check whether ZM is using this libjpeg-turbo library?

Also, if ZM is feeding from mpeg cameras via RTSP and then streaming as mpeg again, then this library will not even be used?

Posted: Fri Nov 19, 2010 1:51 pm
by beanfield
Pada wrote:How do I check whether ZM is using this libjpeg-turbo library?

Also, if ZM is feeding from mpeg cameras via RTSP and then streaming as mpeg again, then this library will not even be used?
"sudo lsof /opt/libjpeg-turbo" will show you which programs are accessing files in that path. It stands for LiSt Open Files. You can specify a particular path to check, a particular pid (with -p), or all open files (with no args). So alternatively, you could do "sudo lsof |grep libjpeg.so.62.0.0" to get an idea of which programs are accessing any libjpeg.so.62.0.0 (whether or not it's in /opt/libjpeg-turbo). Or you could get the pids of your zoneminder processes and do "lsod -p PID".

In my case I ran the second command after installing libjpeg-turbo_1.0.1_amd64.deb from http://sourceforge.net/projects/libjpeg-turbo/files/ and modifying the init script. I can see zoneminder is not calling the libjpeg-turbo version of libjpeg.so.62.0.0. It's calling libjpeg from /usr/lib (default ubuntu version) instead of /opt/libjpeg-turbo (new enhanced version)
# lsof |grep libjpeg.so.62.0.0
...
zmc 5710 www-data mem REG 8,17 146032 3950487 /usr/lib/libjpeg.so.62.0.0
zmc 5715 www-data mem REG 8,17 146032 3950487 /usr/lib/libjpeg.so.62.0.0
zmc 5720 www-data mem REG 8,17 146032 3950487 /usr/lib/libjpeg.so.62.0.0
zma 5734 www-data mem REG 8,17 146032 3950487 /usr/lib/libjpeg.so.62.0.0
zma 5736 www-data mem REG 8,17 146032 3950487 /usr/lib/libjpeg.so.62.0.0
zma 5737 www-data mem REG 8,17 146032 3950487 /usr/lib/libjpeg.so.62.0.0
...
I'm running Ubuntu 10.10, so I did the following:

Code: Select all

# sudo gedit /etc/ld.so.conf.d/libjpeg-turbo.conf
This will be a new file, so just add in a line that says

Code: Select all

/opt/libjpeg-turbo/lib
Then run
# ldconfig
Finally restart zoneminder
# /etc/init.d/zoneminder restart
# lsof |grep libjpeg.so.62.0.0
...
zmc 6426 www-data mem REG 8,17 298151 3980 /opt/libjpeg-turbo/lib/libjpeg.so.62.0.0
zmc 6431 www-data mem REG 8,17 298151 3980 /opt/libjpeg-turbo/lib/libjpeg.so.62.0.0
zmc 6436 www-data mem REG 8,17 298151 3980 /opt/libjpeg-turbo/lib/libjpeg.so.62.0.0
zma 6451 www-data mem REG 8,17 298151 3980 /opt/libjpeg-turbo/lib/libjpeg.so.62.0.0
zma 6452 www-data mem REG 8,17 298151 3980 /opt/libjpeg-turbo/lib/libjpeg.so.62.0.0
zma 6453 www-data mem REG 8,17 298151 3980 /opt/libjpeg-turbo/lib/libjpeg.so.62.0.0
...
Notice how the path for this library is /opt/libjpeg-turbo? ^ verified to be using the new libjpeg-turbo.

Note: you won't need a modified init script after this...nor will you need to set LD_LIBRARY_PATH in your profile. If you only export it in your profile, it only works for programs running as that user. Likewise, if you only export it in the zoneminder init script, only zoneminder will use it. The way I described above will tell all programs to use /opt/libjpeg-turbo. This method should survive ubuntu updates.

Posted: Fri Nov 19, 2010 2:00 pm
by Pada
Thanks a million beanfield!

Posted: Fri Nov 19, 2010 2:01 pm
by beanfield
Pada wrote:Thanks a million beanfield!
np, be sure to follow up if you run into any issues. :D

Posted: Wed Dec 01, 2010 5:17 pm
by Nate23
I have followed beanfields installation instructions step by step but i am not able to see the cpu load decrease everyone else is talking about. When I run the "lsof |grep libjpeg.so.62.0.0" command it shows:

zma 1626 www-data mem REG 8,1 329404 14549015 /opt/libjpeg-turbo/lib/libjpeg.so.62.0.0
zmc 1630 www-data mem REG 8,1 329404 14549015 /opt/libjpeg-turbo/lib/libjpeg.so.62.0.0

for all my camera's. Is there anything else I might be able to try to lower my cpu load?

Thanks

Posted: Wed Dec 01, 2010 5:25 pm
by Pada
Nate23: you will only see a decrease in CPU usage when ZM is saving the video streams as JPEG sequences to the hard drive OR when your cameras are feeding ZoneMinder via M-JPEG streams.
You will not see a decrease in CPU usage when you're feeding/streaming MPEG video streams!

Posted: Wed Dec 01, 2010 6:04 pm
by Nate23
Pada wrote:Nate23: you will only see a decrease in CPU usage when ZM is saving the video streams as JPEG sequences to the hard drive OR when your cameras are feeding ZoneMinder via M-JPEG streams.
You will not see a decrease in CPU usage when you're feeding/streaming MPEG video streams!
I'm currently set to stream jpeg.

Posted: Fri Dec 03, 2010 1:46 pm
by tibetfreedom
knnniggett wrote:The following is one example, specific to Zoneminder, of what dcommander is saying. Find the line in your /etc/init.d/zm script that says "$command start" and place the following just prior to that.

For 64 bit systems:

Code: Select all

export LD_LIBRARY_PATH=/opt/libjpeg-turbo/lib64:$LD_LIBRARY_PATH
For 32 bit systems:

Code: Select all

export LD_LIBRARY_PATH=/opt/libjpeg-turbo/lib:$LD_LIBRARY_PATH
Thanks I loaded into /opt/ and this cut cpu from about 45% to 13% using intel core 2 duo 6600 nice

Posted: Mon Dec 06, 2010 6:32 pm
by novazion
Wonderful. that's impressive.
Thanks beanfield for your help.
Your short tuto just work well.

Posted: Wed Dec 15, 2010 12:20 am
by haus
In my case I had to issue

Code: Select all

cd /usr/local/lib
rm -rf libjpeg.so.62
ln -s  /opt/libjpeg-turbo/lib/libjpeg.so.62.0.0 libjpeg.so.62
service zoneminder restart
Then "lsof | grep jpeg" at the command line shows I'm using /opt/libjpeg-turbo/lib/libjpeg.so.62.0.0. I think the line

Code: Select all

export LD_LIBRARY_PATH=/opt/libjpeg-turbo/lib:$LD_LIBRARY_PATH
in /etc/init.d/zoneminder didn't do anything in my case because after I put that line in and restarted zm it was still using the old jpeg libraries in /usr/local/lib.

Thanks to Yamanipanuchi for posting the solution in this thread:

http://www.zoneminder.com/forums/viewtopic.php?t=16762

Posted: Wed Dec 15, 2010 7:36 am
by PacoLM
Hi,

Will this work in armv5tel version of Debian/ZM???

Thanks in advance,

PacoLM