Patch to cache id3 info

Binesh Bannerjee <[email protected]> Mon, 2 Sep 2002 03:01:18 -0400 (EDT)
Newsgroups gmane.comp.apache.mod-mp3
Message-ID <Pine.LNX.4.44.0209020246120.3751-101000@client.cablemodem.hex21.com>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I'm just submitting this for everyone's approval... And, perhaps to shake
bugs out etc. (It seems to work here...)

I have nearly 17000 mp3s, and it was taking approximately 5 minutes to
start apache... So...

My patch writes the id3/md5sums out to a cache file, based on either the
directory being served or the playlist being served.

Here are the stats for _my_ system:

First run
	[root@cablemodem init.d]# time ./httpd start
	Starting httpd: /usr/local/apache/bin/apachectl startssl: httpd started

	2.07user 6.68system 5:31.06elapsed 2%CPU (0avgtext+0avgdata 0maxresident)k
	0inputs+0outputs (34150major+5349minor)pagefaults 0swaps

Second run,
	[root@cablemodem init.d]# time ./httpd start
	Starting httpd: /usr/local/apache/bin/apachectl startssl: httpd started

	0.91user 2.34system 0:03.44elapsed 94%CPU (0avgtext+0avgdata 0maxresident)k
	0inputs+0outputs (2259major+3804minor)pagefaults 0swaps

As you can see: startup time goes from 5 and a half minutes to 3.44 seconds.

Everything APPEARS to work, though, I have questions which I will post in
a later email...

I'm storing it internally as an AVL tree... (Which is what I'm most
suspicious of.)

Synopsis:
	New files:
		mod_mp3-0.38-binesh/src/cached_mp3_data.c
		mod_mp3-0.38-binesh/src/cached_mp3_data.h

	Changed file:
		mod_mp3-0.38-binesh/src/load.c
		mod_mp3-0.38-binesh/src/internal_dispatch.c
		mod_mp3-0.38-binesh/Makefile.STATIC
		mod_mp3-0.38-binesh/Makefile.tmpl
		mod_mp3-0.38-binesh/configure

internal_dispatch, all I did was a tiny tiny (what I perceive to be)
bug fix... Basically, if you didn't search for anything, mod_mp3 was coring
for me...  So, I simply check to see if signatures is null before
checking if signatures->nelts == max...

The meat of the changes is really load.c and cached_mp3_data.[ch]

Also, since I have apxs, I haven't really tested the Makefiles...

Feedback appreciated...
Binesh Bannerjee

- --
The measure of love is what one is willing to give up for it.

    PGP  Key: http://www.hex21.com/~binesh/binesh-public.asc
    	Key fingerprint = 421D B4C2 2E96 B8EE 7190  A0CF B42F E71C 7FC3 AD96
    SSH2 Key: http://www.hex21.com/~binesh/binesh-ssh2.pub
    SSH1 Key: http://www.hex21.com/~binesh/binesh-ssh1.pub
OpenSSH  Key: http://www.hex21.com/~binesh/binesh-openssh.pub
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)
Comment: pgpenvelope 2.10.2 - http://pgpenvelope.sourceforge.net/

iD8DBQE9cwzKtC/nHH/DrZYRAu4cAJ46U4zPMqt86AiO/ErG5WUaLbDD+gCgtHKd
8ljELtAzbGILedVXujuQLvU=
=4n5/
-----END PGP SIGNATURE-----
mod_mp3-0.38-binesh-patch.bz2 (application/x-bzip2, 5.1 KB) - not displayed