Recent API Issues
We were recently contacted by Cloudflare and told we were on the wrong package for the amount of bandwidth we were using (and the type of content we were caching, mainly images from the API assets) and that we should move to the enterprise plan for $2000/mo.\r\n\r\nOf course, this is more than a couple of years of donations so wasn’t remotely feasible, which prompted me to set up a varnish server to handle the asset requests.\r\n\r\nThis was deployed nearly 2 weeks ago and has mostly been working perfectly, however there were a couple of teething problems and some continuing niggles.\r\n\r\nIn particular there seems to be a lot of people appending the assets url returned with /preview in order to generate a small image, this is not the correct way to get a preview image, and hasn’t been for at least a year or two, the correct way is to replace http://assets.fanart.tv/fanart/ with http://assets.fanart.tv/preview/ (you should actually just replace the fanart with preview in case the domain changes at some point).\r\n\r\nWhen the varnish server was first put in place we had issues with the preview images, that was eventually fixed in line with the documented way, however there was an undocumented method as well (/preview) which I didn’t think about.\r\n\r\nUn-cached preview images cause a small load on the server as they are generated from the larger image, however, after the first generation they are cached and so not an issue, I am not sure a url ending with /preview would actually be cached though.\r\n\r\nI didn’t change anything to stop it working in the first place, but am hesitant to try fixing it again for the following reasons.\r\n
- It’s not the documented method
- If it doesn’t cache the image properly it would be a massive issue as we handle over 1.5billion requests a month, if even 0.5% of that is to /preview that’s over 7.5million requests a month and it’s unlikely the server would be able to cope.
- When the correct url is eventually used the server might initially struggle as it is, no point doubling the amount of imagesit’s trying to cache
\r\nWe have also had 1 report of the wrong image being returned, but noone else saw that, so I’m not sure if it was a local caching issue, but if anyone else sees this please let us know in the IRC channel (Community / Chat With Us)