Compression with API

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Compression with API

Petr Bena
Hi,

I created this ticket: https://phabricator.wikimedia.org/T119878

The basic idea is that it shouldn't be a big problem to compress
output of api.php script using some widely available library, like
gzip.

That way the size of communication between client and server would be
much smaller and users with slow internet might benefit from this. I
am not sure how much the data would be reduced, but it could be a
significant number in some cases.

What do you think about it? Is there any reason not to do that?

Note I don't propose some breaking change, rather just create an
optional parameter "compression" that would be passed for API
requests.

_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: Compression with API

Petr Bena
Also, mobile phones would probably benefit from this most, if there is
some wiki-reader app that uses API for it to work.

On Mon, Nov 30, 2015 at 5:10 PM, Petr Bena <[hidden email]> wrote:

> Hi,
>
> I created this ticket: https://phabricator.wikimedia.org/T119878
>
> The basic idea is that it shouldn't be a big problem to compress
> output of api.php script using some widely available library, like
> gzip.
>
> That way the size of communication between client and server would be
> much smaller and users with slow internet might benefit from this. I
> am not sure how much the data would be reduced, but it could be a
> significant number in some cases.
>
> What do you think about it? Is there any reason not to do that?
>
> Note I don't propose some breaking change, rather just create an
> optional parameter "compression" that would be passed for API
> requests.

_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: Compression with API

Brad Jorsch (Anomie)
In reply to this post by Petr Bena
On Mon, Nov 30, 2015 at 11:10 AM, Petr Bena <[hidden email]> wrote:

> Is there any reason not to do that?
>

That the HTTP Accept-Encoding header[1] already exists?

 [1]: https://tools.ietf.org/html/rfc7231#section-5.3.4


--
Brad Jorsch (Anomie)
Senior Software Engineer
Wikimedia Foundation
_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: Compression with API

Dmitry Brant
In reply to this post by Petr Bena
> ...if there is some wiki-reader app that uses API for it to work.

There is indeed[0], and it does! :)

[0] https://play.google.com/store/apps/details?id=org.wikipedia&hl=en


On Mon, Nov 30, 2015 at 11:11 AM, Petr Bena <[hidden email]> wrote:

> Also, mobile phones would probably benefit from this most, if there is
> some wiki-reader app that uses API for it to work.
>
> On Mon, Nov 30, 2015 at 5:10 PM, Petr Bena <[hidden email]> wrote:
> > Hi,
> >
> > I created this ticket: https://phabricator.wikimedia.org/T119878
> >
> > The basic idea is that it shouldn't be a big problem to compress
> > output of api.php script using some widely available library, like
> > gzip.
> >
> > That way the size of communication between client and server would be
> > much smaller and users with slow internet might benefit from this. I
> > am not sure how much the data would be reduced, but it could be a
> > significant number in some cases.
> >
> > What do you think about it? Is there any reason not to do that?
> >
> > Note I don't propose some breaking change, rather just create an
> > optional parameter "compression" that would be passed for API
> > requests.
>
> _______________________________________________
> Wikitech-l mailing list
> [hidden email]
> https://lists.wikimedia.org/mailman/listinfo/wikitech-l




--
Dmitry Brant
Mobile Apps Team (Android)
Wikimedia Foundation
https://www.mediawiki.org/wiki/Wikimedia_mobile_engineering
_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: Compression with API

Petr Bena
In reply to this post by Brad Jorsch (Anomie)
Interesting. I was googling for something like that, but for whatever
reasons it just wasn't anywhere in the results...

On Mon, Nov 30, 2015 at 5:12 PM, Brad Jorsch (Anomie)
<[hidden email]> wrote:

> On Mon, Nov 30, 2015 at 11:10 AM, Petr Bena <[hidden email]> wrote:
>
>> Is there any reason not to do that?
>>
>
> That the HTTP Accept-Encoding header[1] already exists?
>
>  [1]: https://tools.ietf.org/html/rfc7231#section-5.3.4
>
>
> --
> Brad Jorsch (Anomie)
> Senior Software Engineer
> Wikimedia Foundation
> _______________________________________________
> Wikitech-l mailing list
> [hidden email]
> https://lists.wikimedia.org/mailman/listinfo/wikitech-l

_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: Compression with API

Antoine Musso-3
In reply to this post by Petr Bena
Le 30/11/2015 17:10, Petr Bena a écrit :

> Hi,
>
> I created this ticket: https://phabricator.wikimedia.org/T119878
>
> The basic idea is that it shouldn't be a big problem to compress
> output of api.php script using some widely available library, like
> gzip.
>
> That way the size of communication between client and server would be
> much smaller and users with slow internet might benefit from this. I
> am not sure how much the data would be reduced, but it could be a
> significant number in some cases.
>
> What do you think about it? Is there any reason not to do that?
>
> Note I don't propose some breaking change, rather just create an
> optional parameter "compression" that would be passed for API
> requests.

Hello,

That is supported by http clients/servers by sending a header.

curl --verbose https://www.mediawiki.org/w/api.php >/dev/null
> Accept: */*

23kbytes payload

curl --compressed --verbose https://www.mediawiki.org/w/api.php >/dev/null
> Accept: */*
> Accept-Encoding: deflate, gzip

6kbytes payload


So just pass:  'Accept-Encoding: gzip', and you should be served gziped
content by Mediawiki.



--
Antoine "hashar" Musso


_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l