Preserving the database after restarting Twonky

General discussion about the media server. Feature requests. Hints, tips and tricks.
Locked
divB
Posts:11
Joined:Thu Apr 28, 2011 7:33 pm
AV Hardware:Sony Bravia TV
Preserving the database after restarting Twonky

Post by divB » Fri Apr 29, 2011 3:31 pm

Hi,

Is it really true that Twonky rebuilds its database everytime it is restarted??

This can't be the case - it takes up to one hour to scan the disk.

Is there an option to preserve the database?

Or even better: Diable the database completely? I only use the directory listing so I do not need any database. It could be generated on-the-fly from the file system.

Just a usecase why this is impractical: Friends come to watch newest fotos. Just in this case the server crashes. Reboot wouldn't be a problem, however, rebuilding which takes 1 hour to get the media server up again is too impractical.

Regards,
divB

User avatar
phibertron
Posts:1566
Joined:Sun Jan 30, 2011 5:52 pm
AV Hardware:Hardware
========
WHS - HP Ex495
PS3
XBOX 360
iTouch - Gen 2 and Gen 3
PSP - 3000

Encoders
========
Handbrake
x264
ffmpeg
mencoder

Tagging
======
mp3tag

Re: Preserving the database after restarting Twonky

Post by phibertron » Fri Apr 29, 2011 5:29 pm

a rescan and rebuild are two different things
upon restart twonky does a rescan
on the one hand I can see why they do it
on the other, why do it at all
but yes, it would be nice to be able to turn that feature off
at present we can not stop that behavior
viewtopic.php?f=2&t=10627
viewtopic.php?f=2&t=9353
viewtopic.php?f=2&t=9408
viewtopic.php?f=2&t=9416
viewtopic.php?f=2&t=9424
viewtopic.php?f=2&t=9364
viewtopic.php?f=2&t=9497

divB
Posts:11
Joined:Thu Apr 28, 2011 7:33 pm
AV Hardware:Sony Bravia TV

Re: Preserving the database after restarting Twonky

Post by divB » Fri Apr 29, 2011 5:47 pm

Hi,

Thanks for your reply.

I do not fully understand you - what do you mean by rebuild and rescan?

The main problem is that the server can not be (fully) used until the disk-scan has finished.

I measured now: It takes exactly 30 minutes (!) on a very powerful server system: Dual Xeon with two cores of 3.4Ghz, 8GB RAM. Yes, the database is large but that's really a problem.

So if I understand you correctly there is no way to improve this?

Regards,
divB

User avatar
parnott
Posts:326
Joined:Mon Sep 20, 2010 9:55 pm
AV Hardware:Twonky, WDTV Live, XBMC (Linux & Windows)

Re: Preserving the database after restarting Twonky

Post by parnott » Fri Apr 29, 2011 8:08 pm

No Twonky does not do a full re-build of the database when restarted EXCEPT for the situation when the server reboot procedure deletes the Twonky database. Many NAS devices do this unless configured correctly.

What OS are you running Twonky on?

No you can't run Twonky without its database, that was the way it was intended to work.

divB
Posts:11
Joined:Thu Apr 28, 2011 7:33 pm
AV Hardware:Sony Bravia TV

Re: Preserving the database after restarting Twonky

Post by divB » Fri Apr 29, 2011 8:51 pm

Hi,

It is a full-fledged Debian squeeze on a 4 core Xeon with 3.4 Ghz, 8GB RAM and a 2TB media disk.

I just tell you what I observe: When I restart TwonkyServer:

./twonkymedia.sh stop
./twonkymedia.sh start

I go into /config -> Server status I get

Last database change: In Progress...
[+/media/data/Fotos]...
Music tracks: 0
Photos: 26640
Videos: 0

As you can see, Music and Videos is 0. When I use the filebrowser (or access from TV) there is only the "Photos" folder. It takes about 30 minutes until all fields show their correct value and all files can be served.

More seriously, most time, it begins with "Music tracks" which takes the longest time. Therefore I need to wait 30 minutes until I can access Photos or videos.

Of course, /var/twonkymedia/twonkymedia is not emptied and kept as is!

Regards,
divB

User avatar
edrikk
Posts:114
Joined:Wed Dec 12, 2007 7:33 pm

Re: Preserving the database after restarting Twonky

Post by edrikk » Sat Apr 30, 2011 1:57 am

Yup.
Others always say this is not the case, but it is...

Same behaviour here, on a QNap 209 (which ARM based... pretty much uses the Kirkwood build)

It's not a "rescan".. the DB is wiped, and scanned a freshed each restart.

User avatar
parnott
Posts:326
Joined:Mon Sep 20, 2010 9:55 pm
AV Hardware:Twonky, WDTV Live, XBMC (Linux & Windows)

Re: Preserving the database after restarting Twonky

Post by parnott » Sat Apr 30, 2011 7:31 pm

OK If you insist that it is rebuilding (rather than just rescanning) the database try these tests-

1) Go to the Twonky Config page and select Maintenance from the menu options on the left. Click on the 'Restart server' button at the top of the page. Wait a minute or so. Twonky will RESCAN all the files but it should only take a few minutes and you should be able to stream media during this time. This is what I see on my NAS.

2) Reboot your server. Wait a minute or so until the server is fully up and running. Try and access Twonky from your media player, if you can't and there is a lot of disk activity on the server that lasts more than a few minutes then yes Twonky is rebuilding its database because the database was removed during the reboot.

If you have situation 2 then what you need to do is use a location in the file system for the Twonky database that is preserved across reboots. For this you use the -appdata switch on the command that starts Twonky.

OH and also make sure Twonky does not get started too early in the boot sequence, it should be around S80 or S90.

divB
Posts:11
Joined:Thu Apr 28, 2011 7:33 pm
AV Hardware:Sony Bravia TV

Re: Preserving the database after restarting Twonky

Post by divB » Sun May 01, 2011 3:16 pm

OK If you insist that it is rebuilding (rather than just rescanning) the database try these tests-
Yes, you are right. I tried it. But it does not become better:

For testing, I deleted /var/twonkymedia. The result was a rebuild. I took about 1:30 hours!!!

When I just restart Twonky, it is a rescan which takes 30 minutes! This is the situation I described until now.

Now please remember: It is a dual Xeon 3.4 Ghz. Not a small NAS, but a full-fledged server. Rescan does not takes minutes but half an hour!

This is ugly, really ugly and but ... however, it seems that I have no other chances :-(

User avatar
parnott
Posts:326
Joined:Mon Sep 20, 2010 9:55 pm
AV Hardware:Twonky, WDTV Live, XBMC (Linux & Windows)

Re: Preserving the database after restarting Twonky

Post by parnott » Sun May 01, 2011 4:47 pm

divB wrote:
For testing, I deleted /var/twonkymedia. The result was a rebuild. I took about 1:30 hours!!!

When I just restart Twonky, it is a rescan which takes 30 minutes! This is the situation I described until now.

Now please remember: It is a dual Xeon 3.4 Ghz. Not a small NAS, but a full-fledged server. Rescan does not takes minutes but half an hour!
How many media files are there in total?
Have you made sure that Twonky is only sharing directories with media files? What are your sharing paths?
How is your disk connected to your computer (e.g. SATA, USB, etc.)?

All of these are factors in how long a rescan/rebuild will take, it is not all about how powerful the CPU is.

Also I don't recall having to wait until the rescan was complete to be able to access media. And yes I am running a small NAS.

Locked