Maximum size of JSON RPC batch requests

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
nonpolar Offline
Junior Member
Posts: 17
Joined: May 2010
Reputation: 0
Post: #1
Hi!

I am sending a batch request via JSON RPC.
If the requests exceed a certain size, I only get an empty HTTP 200 back. If I remove a couple of requests I get the expected answer back.

What's the maximum number of batch requests supported?

Thanks,
nonpolar
(This post was last modified: 2012-03-24 23:28 by nonpolar.)
find quote
Montellese Offline
Team-XBMC Developer
Posts: 3,621
Joined: Jan 2009
Reputation: 34
Location: Switzerland
Post: #2
It's probably not the number of JSON-RPC requests which is the limiting factor here but the number of characters in your HTTP request. I'll have to investigate to find the maximum possible size of a HTTP request. How many requests/characters are you sending which only gives you an empty HTTP 200 response?

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

[Image: badge.gif]
find quote
Montellese Offline
Team-XBMC Developer
Posts: 3,621
Joined: Jan 2009
Reputation: 34
Location: Switzerland
Post: #3
OK I checked the HTTP specification and there is no limit specified in there. It is up to the server to decide on a maximum size of the body of a POST request. I looked into XBMC's code and currently the maximum size is 20000 (20k) bytes but I doubt that your request contains that many characters?!

Could you provide the two batch requests you execute so I can see if I can reproduce the problem? Thanks.

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

[Image: badge.gif]
find quote
nonpolar Offline
Junior Member
Posts: 17
Joined: May 2010
Reputation: 0
Post: #4
First of all thanks for your support!

Your findings are matching mine - seems like the spec does not limit this. As far as I found out the browser and the technology employed on the server may impose other restrictions on the maximum length.

I will provide you an example, if that helps - basically I am sending a batch request to Files.PrepareDownload for getting all thumbnail URLs of all albums at once. Possibly this is a bad idea? :-)
find quote
Montellese Offline
Team-XBMC Developer
Posts: 3,621
Joined: Jan 2009
Reputation: 34
Location: Switzerland
Post: #5
Currently you don't really need to call Files.PrepareDownload at all. All the download URL's are
Code:
http://<your-ip>:<your-port>/vfs/<url-encoded-thumbnail-path>

So just URL encode the path you get from JSON-RPC, prepend "/vfs/" and send that to XBMC's webserver and you should be fine.
This behaviour might change in the future but for now it works just fine.

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

[Image: badge.gif]
find quote
nonpolar Offline
Junior Member
Posts: 17
Joined: May 2010
Reputation: 0
Post: #6
I was thinking about that - but I thought better safe than sorry and use Files.PrepareDownload...
find quote
Montellese Offline
Team-XBMC Developer
Posts: 3,621
Joined: Jan 2009
Reputation: 34
Location: Switzerland
Post: #7
I totally agree with you on this and I usually recommend using Files.PrepareDownload just to be on the safe side. I'm not sure if it makes sense to retrieve the URLs for all the paths in one batch request. That kind of eliminates the possibility to start downloading one album while looking up the URL for the next one which would allow lazy-loading of the images.

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

[Image: badge.gif]
find quote
nonpolar Offline
Junior Member
Posts: 17
Joined: May 2010
Reputation: 0
Post: #8
Hmmm.

I assumed that the "heavy" work rather is loading the images and I wanted to rely on the browser to handle that task in a performant way. The goal is, to show a searchable list of all albums having the correct thumnail path set - the thumbnails would then be loaded by the browser.
Using batch requests, I think loading the thumb paths should not result say in more than 10 batch requests à 100 paths. Not sure about the mean library size of albums though...

Lazy loading causes a lot of additional effort and in addition to that it's not possible anymore to search via JSON RPC. That's (and the lack of a mobile javascript ui list widget supporting lazy loading out of the box) why I wanted to load all paths at once.

I am getting off-topic... ;-)
(This post was last modified: 2012-03-26 00:06 by nonpolar.)
find quote
joethefox Offline
Team-XBMC Member
Posts: 1,276
Joined: Nov 2010
Reputation: 22
Post: #9
(2012-03-25 22:14)Montellese Wrote:  All the download URL's are
Code:
http://<your-ip>:<your-port>/vfs/<url-encoded-thumbnail-path>

So just URL encode the path you get from JSON-RPC, prepend "/vfs/" and send that to XBMC's webserver and you should be fine.
This behaviour might change in the future but for now it works just fine.

NOOO!!!! this is exactly how I get the thumbnails. When you say "This behaviour might change in the future", has this behaviour a lifetime and it will be marked as deprecated and then removed from the API or just one day it will disappearConfused
find quote
Montellese Offline
Team-XBMC Developer
Posts: 3,621
Joined: Jan 2009
Reputation: 34
Location: Switzerland
Post: #10
No there's no specified lifetime. I'm just saying that the method Files.PrepareDownload is there for a reason and that one day in the future the "vfs/" path will be replaced by something else. If that ever happens it will probably be deprecated for a while i.e. the new way to access thumbnails will be made available while the existing one will also be available but no worries I won't just remove something like that without mentioning it.

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

[Image: badge.gif]
find quote
joethefox Offline
Team-XBMC Member
Posts: 1,276
Joined: Nov 2010
Reputation: 22
Post: #11
thanks for the answer that stop worrying me.
find quote