Re: DB-murdering API query (index suggestions needed)

2019-11-17 Thread Stewart Smith

> On 15 Nov 2019, at 09:43, Konstantin Ryabitsev 
>  wrote:
> 
> On Sat, Nov 16, 2019 at 12:48:33AM +1100, Daniel Axtens wrote:
>>> GET
>>> /api/1.1/patches/?project=62=2019-11-01T00:00:00_page=100=6150
>>> The query behind this takes about 1 minute to run on a 20-core HT Xeon
>>> system and requires creating a huge temporary file (there are 18375
>>> patches in that project).
>> Ouch, I'm sorry to hear that.
> 
> Well, it's true that some of kernel.org's projects are large beyond what 
> would be considered "sane". :)

My thought is that we should make it so that Patchwork is able to cope.

It’s not *that* much data or that complex queries (he says with his database 
hat on) :)


___
Patchwork mailing list
Patchwork@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/patchwork


Re: DB-murdering API query (index suggestions needed)

2019-11-17 Thread Stewart Smith

> On 15 Nov 2019, at 05:48, Daniel Axtens  wrote:
> 
> 
>> 
>> Today, the DB behind patchwork.kernel.org was in a semi-permanent state 
>> of suffering due to someone trying to suck down all patches in the 
>> linux-arm-kernel project. This is what the API request looked like:
>> 
>> GET 
>> /api/1.1/patches/?project=62=2019-11-01T00:00:00_page=100=6150
>>  
>> 
>> The query behind this takes about 1 minute to run on a 20-core HT Xeon 
>> system and requires creating a huge temporary file (there are 18375 
>> patches in that project).
> 
> Ouch, I'm sorry to hear that.
> 
>> 
>> So, two questions, really:
>> 
>> 1. Any indexes we can put in place to make this query perform better?
> 
> We have a bunch of db magic contributed by Stewart that will hit 2.2.
> 
> Stewart, do you happen to know if any of your magic will affect API
> queries? They're advertised as affecting the general listing of patches
> in the UI, I'm not sure if they also affect this.
> 
> If not, we can definitely have a look at getting an index or rate
> limiting/authentication thingy in for 2.2.

I am pretty sure that my improvements would help in that specific query, 
probably not enough to be ideal though. I know they improve the web site 
equivalent operation, but don’t remember how much (if any) I poked at the API 
there.

I could take a look, I’d just need to set up a dev environment and grab a good 
set of data again.
___
Patchwork mailing list
Patchwork@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/patchwork