Slow and inneficient http/httpss source parsing?
#1
Hi,

I'm new to the forum, but have been using XBMC for a while (and dabbled in plex as well). I do prefer XBMC due to the multiple platform compatibility, and the maturity when compared to plex. I was also very excited to find http and https source creation capability in XBMC, which is still lacking in plex (plex supports local disk, smb:// and ftp sources only).

Now, to the question...

I have all my content on a HTTPS server on the Internet. I have basic auth, certs, etc all configured (I have administered a number of apache servers in my lifetime, that was the easy part).

I have XBMC installed on a few machines, and even set it up on relative's computers. All pointed to my HTTPS content on the server, and all content is streamed. Works VERY well, except for one thing - the speed of looking through folders in file mode, or indexing content. A directory with 500 movies takes upwards of 24 hours to index! And going in through file mode into any source/folder with more than about 50 items takes upwards of 5 minutes... it is very frustrating, to say the least.

I started looking into what might be causing this, and the logs on the webserver make me believe that XBMC does the following when it opens a http/https source (the curl libraries being used to do the http/https calls):

1. Do a 'GET' for the top level directory of the configured HTTPS source
2. For each item returned, do a 'HEAD' method call for the content, initiating a new http connection every time!?!

Let's call the two steps above a 'LIST' action ;-)

in addition to the above, when an indexing process is being performed (library update), I see XBMC perform exactly one full cycle of the two steps above, per each movie being indexed!? In other words, it seems to do a 'LIST' as per above to get a listing of all the files/directories in the source folder, then for each one in there - scrape/index and update library, followed by another 'LIST', and so on.

The above seems to be an *extremely* inefficient way to do this, considering I can get a full file/directory listing (even recursive one) of all the content there using a tool like 'wget', in mere seconds, and in a single https connection... For a directory with 500 movie files, that means it will do 501 full 'LIST' actions, each one (including each 'HEAD' call) being made in a brand new https connection... just the time to setup and tear down that many http connections to a server that is any reasonable amount of latency away from the client is a lot of wasted time...

So, is that behavior by design, is it a bug, is it a side-effect of how the browsing/indexing was initially written for a local or mounted file systems calls, and then was 'ported' to leverage curl for a remote http/https 'filesystem' ? Is anyone aware of a plugin that maybe does this better?

Can someone point me to which part of the code implements this?

cheers,
jordan

debugs from xbmc on the client side (Dharma RC1 running on windows) - this is for ONE item of content. Had to wrap it in php as the I couldn't post it raw due to having '45 smileys' ;-) :

PHP Code:
15:56:30 T:372 M:1945710592   DEBUGCFileCurl::GetMimeType - [url]https://[email protected]:443/media/Movies/Some%20Movie%20(1994).avi[/url] - > video/x-msvideo
15:56:30 T:372 M:1945714688   DEBUGCurl::Debug About to connect() to xbmcserver.org port 443 (#0)
15:56:30 T:372 M:1945714688   DEBUGCurl::Debug   Trying 1.2.3.4...
15:56:30 T:372 M:1945694208   DEBUGCurl::Debug connected
15
:56:30 T:372 M:1945694208   DEBUGCurl::Debug Connected to xbmcserver.org (1.2.3.4port 443 (#0)
15:56:30 T:372 M:1945694208   DEBUGCurl::Debug SSL re-using session ID
15
:56:30 T:372 M:1945694208   DEBUGCurl::Debug SSLv3TLS handshakeClient hello (1):
15:56:30 T:372 M:1945694208   DEBUGCurl::Debug .
15:56:30 T:372 M:1945694208   DEBUGCurl::Debug
15
:56:30 T:372 M:1945694208   DEBUGCurl::Debug SSLv3TLS handshakeServer hello (2):
15:56:30 T:372 M:1945694208   DEBUGCurl::Debug .
15:56:30 T:372 M:1945694208   DEBUGCurl::Debug SSLv3TLS change cipherClient hello (1):
15:56:30 T:372 M:1945694208   DEBUGCurl::Debug .
15:56:30 T:372 M:1945694208   DEBUGCurl::Debug SSLv3TLS handshakeFinished (20):
15:56:30 T:372 M:1945694208   DEBUGCurl::Debug Â¶
15
:56:30 T:372 M:1945694208   DEBUGCurl::Debug SSLv3TLS change cipherClient hello (1):
15:56:30 T:372 M:1945694208   DEBUGCurl::Debug .
15:56:30 T:372 M:1945694208   DEBUGCurl::Debug SSLv3TLS handshakeFinished (20):
15:56:30 T:372 M:1945694208   DEBUGCurl::Debug Â¶
15
:56:30 T:372 M:1945694208   DEBUGCurl::Debug SSL connection using DHE-RSA-AES256-SHA
15
:56:30 T:372 M:1945694208   DEBUGCurl::Debug Server certificate:
15:56:30 T:372 M:1945694208   DEBUGCurl::Debug         subjectC=XXST=YYYL=ZZZO=asdfOU=HomeCN=xbmcserver.orgemailAdd ress=postmaster@xbmcserver.org
15
:56:30 T:372 M:1945694208   DEBUGCurl::Debug         start date2008-11-28 22:56:52 GMT
15
:56:30 T:372 M:1945694208   DEBUGCurl::Debug         expire date2018-11-26 22:56:52 GMT
15
:56:30 T:372 M:1945694208   DEBUGCurl::Debug         issuerC=XXST=YYYL=ZZZO=asdfOU=HomeCN=asdf Root CAemailAddre ss=postmaster@xbmcserver.org
15
:56:30 T:372 M:1945694208   DEBUGCurl::Debug         SSL certificate verify resultunable to get local issuer certificate (20), continuing anyway.
15:56:30 T:372 M:1945694208   DEBUGCurl::Debug Server auth using Basic with user 'username'
15:56:30 T:372 M:1945694208   DEBUGCurl::Debug HEAD /media/Movies/Some%20Other%20Movie%20(1984).avi HTTP/1.1
15
:56:30 T:372 M:1945694208   DEBUGCurl::Debug AuthorizationBasic asdfiowekasdldfs
15
:56:30 T:372 M:1945694208   DEBUGCurl::Debug User-AgentXBMC/10.0-rc1 r35325 (WindowsWindows 764-bit (WoWbuild 7600; [url]http://www.xbmc.org[/url])
15:56:30 T:372 M:1945694208   DEBUGCurl::Debug Hostxbmcserver.org:443
15
:56:30 T:372 M:1945694208   DEBUGCurl::Debug Accept: */*
15:56:30 T:372 M:1945694208   DEBUG: Curl::Debug Referer:
15:56:30 T:372 M:1945694208   DEBUG: Curl::Debug Connection: keep-alive
15:56:31 T:372 M:1948655616   DEBUG: Curl::Debug HTTP/1.1 200 OK
15:56:31 T:372 M:1948655616   DEBUG: Curl::Debug Date: Fri, 19 Nov 2010 22:56:40 GMT
15:56:31 T:372 M:1948655616   DEBUG: Curl::Debug Server: Apache
15:56:31 T:372 M:1948655616   DEBUG: Curl::Debug Last-Modified: Mon, 15 Nov 2010 01:25:20 GMT
15:56:31 T:372 M:1948655616   DEBUG: Curl::Debug ETag: "20068002-77328000-4950d503b0000"
15:56:31 T:372 M:1948655616   DEBUG: Curl::Debug Accept-Ranges: bytes
15:56:31 T:372 M:1948655616   DEBUG: Curl::Debug Content-Length: 1999798272
15:56:31 T:372 M:1948655616   DEBUG: Curl::Debug Connection: close
15:56:31 T:372 M:1948655616   DEBUG: Curl::Debug Content-Type: video/x-msvideo
15:56:31 T:372 M:1948655616   DEBUG: Curl::Debug Closing connection #0
15:56:31 T:372 M:1948655616   DEBUG: Curl::Debug SSLv3, TLS alert, Client hello (1):
15:56:31 T:372 M:1948655616   DEBUG: Curl::Debug . 

apache logs on the server side - this is the beginning of a library update run. It repeats fully for every item in a listing:

1.2.3.4 - username [19/Nov/2010:22:56:26 +0000] "GET /videos/Movies/ HTTP/1.1" 200 72530
1.2.3.4 - username [19/Nov/2010:22:56:29 +0000] "HEAD /videos/Movies/8%20Mile%20(2002).mp4 HTTP/1.1" 200 -
1.2.3.4 - username [19/Nov/2010:22:56:30 +0000] "HEAD /videos/Movies/12%20Angry%20Men%20(1957).avi HTTP/1.1" 200 -
1.2.3.4 - username [19/Nov/2010:22:56:31 +0000] "HEAD /videos/Movies/12%20Monkeys%20(1995).avi HTTP/1.1" 200 -
1.2.3.4 - username [19/Nov/2010:22:56:31 +0000] "HEAD /videos/Movies/36%20Hours%20(1965).avi HTTP/1.1" 200 -
1.2.3.4 - username [19/Nov/2010:22:56:32 +0000] "HEAD /videos/Movies/50%20First%20Dates%20(2004).avi HTTP/1.1" 200 -
1.2.3.4 - username [19/Nov/2010:22:56:33 +0000] "HEAD /videos/Movies/A%20Bright%20Shining%20Lie%20(1998).avi HTTP/1.1" 200 -
1.2.3.4 - username [19/Nov/2010:22:56:34 +0000] "HEAD /videos/Movies/A%20Civil%20Action%20(1998).avi HTTP/1.1" 200 -
1.2.3.4 - username [19/Nov/2010:22:56:35 +0000] "HEAD /videos/Movies/A%20Clockwork%20Orange%20(1971).mp4 HTTP/1.1" 200 -
1.2.3.4 - username [19/Nov/2010:22:56:36 +0000] "HEAD /videos/Movies/A%20Few%20Good%20Men%20(1992).avi HTTP/1.1" 200 -
1.2.3.4 - username [19/Nov/2010:22:56:37 +0000] "HEAD /videos/Movies/A%20History%20of%20Violence%20(2005).avi HTTP/1.1" 200 -
1.2.3.4 - username [19/Nov/2010:22:56:37 +0000] "HEAD /videos/Movies/A%20Serious%20Man%20(2009).avi HTTP/1.1" 200 -
1.2.3.4 - username [19/Nov/2010:22:56:38 +0000] "HEAD /videos/Movies/Affliction%20(1997).avi HTTP/1.1" 200 -
1.2.3.4 - username [19/Nov/2010:22:56:39 +0000] "HEAD /videos/Movies/Against%20the%20Wall%20(1994).avi HTTP/1.1" 200 -
1.2.3.4 - username [19/Nov/2010:22:56:40 +0000] "HEAD /videos/Movies/Amadeus%20(1984).avi HTTP/1.1" 200 -
1.2.3.4 - username [19/Nov/2010:22:56:41 +0000] "HEAD /videos/Movies/American%20Heart%20(1992).avi HTTP/1.1" 200 -
1.2.3.4 - username [19/Nov/2010:22:56:42 +0000] "HEAD /videos/Movies/American%20Psycho%20(2000).avi HTTP/1.1" 200 -
1.2.3.4 - username [19/Nov/2010:22:56:43 +0000] "HEAD /videos/Movies/An%20Education%20(2009).avi HTTP/1.1" 200 -
1.2.3.4 - username [19/Nov/2010:22:56:43 +0000] "HEAD /videos/Movies/An%20Inconvenient%20Truth%20(2006).avi HTTP/1.1" 200 -
1.2.3.4 - username [19/Nov/2010:22:56:44 +0000] "HEAD /videos/Movies/And%20Justice%20for%20All%20(1979).avi HTTP/1.1" 200 -
Reply
#2
moved to a different forum.

http://forum.xbmc.org/showthread.php?tid=85946
Reply
#3
I'm obviously not as saavy as you are as far as the server side mechanics go, but could I suggest rather than reading file directories, use XBMC in library mode, and host the database on mysql. That way only one system needs to make database updates when the content is changed. I use this system myself more locally (3 machines in my house) and it works fantastically.

Just .02
Reply
#4
blacklist Wrote:I'm obviously not as saavy as you are as far as the server side mechanics go, but could I suggest rather than reading file directories, use XBMC in library mode, and host the database on mysql. That way only one system needs to make database updates when the content is changed. I use this system myself more locally (3 machines in my house) and it works fantastically.

Just .02

Thanks for the suggestion, but the problem is actually getting the library setup in the first place. Once the library is created/indexed - it's actually relatively fast, as it no longer needs to go back and look at all the content on the server - just the specific file that is referenced in the library. So, moving the library to mysql is going to have no effect on the time it takes to set it up, I think...
Reply
#5
jordank Wrote:Thanks for the suggestion, but the problem is actually getting the library setup in the first place. Once the library is created/indexed - it's actually relatively fast, as it no longer needs to go back and look at all the content on the server - just the specific file that is referenced in the library. So, moving the library to mysql is going to have no effect on the time it takes to set it up, I think...

Except that once its all indexed into the server, the local client is actually just looking at the server data, so there is in effect no set up, since the database content is not stored locally. There is also no syncing on the local machines, since everytime to open the movies screen, it is pulling the list from mysql.

The only other network traffic mine creates other than database calls is because my thumbs/fanart are stored on a network folder rather than locally. An alternative is to copy the thumbs/fanart to local machines, but this requires some maintance.
Reply

Logout Mark Read Team Forum Stats Members Help
Slow and inneficient http/httpss source parsing?0