🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
72 messages
72 total messages Page 2 of 2 Started by Julien ÉLIE Tue, 13 Oct 2015 20:21
Page 2 of 2 • 72 total messages
Re: About compression with NNTP
#87218
Author: Julien ÉLIE
Date: Thu, 12 Nov 2015 21:35
36 lines
2838 bytes
Hi Ken,

> The
> server is in a much better position to understand the content and is
> able to adjust the compression setting on the fly within the connection.

NNTP does not have the Binary content extension that IMAP has; my worry 
is that the server does not necessarily understand what it is sending. 
Otherwise, it would mean that the server performs decoding of 
MIME-encoded contents to see what it might be, and then adjust the 
compression level accordingly?



> This is what is outlined in IMAP COMPRESS with similar text that we
> removed from NNTP COMPRESS, and at the very least, the Cyrus IMAP server
> does adjust the compression level according to the content.

Doesn't such decoding consume too many CPU resources when thousands of 
users are connected at the same time and massively download articles?



> Note that the compression levels of what the client sends to the server
> and what the server sends to the client can be different from one
> another.  They are two separate streams with separate dictionaries.

Yep.

-- 
Julien ÉLIE

« Aliquis non debet esse iudex in propria causa, quia non potest esse
   iudex et pars. »

Re: About compression with NNTP
#87216
Author: Ken Murchison
Date: Thu, 12 Nov 2015 22:16
43 lines
3296 bytes
On 11/12/2015 04:35 PM, Julien ÉLIE wrote:
> Hi Ken,
>
>> The
>> server is in a much better position to understand the content and is
>> able to adjust the compression setting on the fly within the connection.
>
> NNTP does not have the Binary content extension that IMAP has; my 
> worry is that the server does not necessarily understand what it is 
> sending. Otherwise, it would mean that the server performs decoding of 
> MIME-encoded contents to see what it might be, and then adjust the 
> compression level accordingly?

Why would it have to decode the MIME entity?  The server should be able 
to tell from the Content-Type and Content-Encoding what is enclosed.  
Obviously, image/jpeg and application/gzip shouldn't be compressed.  The 
server should also be able to detect whatever craziness yEnc does.

Maybe I'm missing how NNTP is used or client/server software is 
written.  The nntpd that is part of Cyrus IMAP would have no problem 
leveraging what we do for IMAP (see below) and adjusting compression on 
the fly.


>
>> This is what is outlined in IMAP COMPRESS with similar text that we
>> removed from NNTP COMPRESS, and at the very least, the Cyrus IMAP server
>> does adjust the compression level according to the content.
>
> Doesn't such decoding consume too many CPU resources when thousands of 
> users are connected at the same time and massively download articles?

Not sure what you mean.  The IMAP server has a view of the MIME 
structure of each message and knows what the content is and adjusts 
compression accordingly.

-- 
Kenneth Murchison
Principal Systems Software Engineer
Carnegie Mellon University


Re: About compression with NNTP
#87217
Author: Michael Baeuerle
Date: Fri, 13 Nov 2015 10:24
29 lines
2687 bytes
Ken Murchison wrote:
> On 11/12/2015 04:35 PM, Julien ÉLIE wrote:
> > Ken Murchison wrote:
> > > 
> > > The
> > > server is in a much better position to understand the content and is
> > > able to adjust the compression setting on the fly within the connection.
> > 
> > NNTP does not have the Binary content extension that IMAP has; my worry 
> > is that the server does not necessarily understand what it is sending. 
> > Otherwise, it would mean that the server performs decoding of 
> > MIME-encoded contents to see what it might be, and then adjust the 
> > compression level accordingly?
> 
> Why would it have to decode the MIME entity?  The server should be able 
> to tell from the Content-Type and Content-Encoding what is enclosed.

Unfortunately MIME allows things like "nested multipart". Looking at the
Content-Type field in the header and (if it is "multipart/*") at the
Content-Type fields of all top-level body parts may not reveal that
compressed content is present. Example:

multipart/mixed
   multipart/mixed
      text/plain
      application/gzip
   text/plain

Re: About compression with NNTP
#87219
Author: Michael Baeuerle
Date: Fri, 13 Nov 2015 11:44
13 lines
1522 bytes
Michael Baeuerle wrote:
> 
> Now it seems to work with TLS and AUTH too:
> [...]

The compression bits in flnews are now implemented. I will do some loop-
back tests first and if they should look good I am ready for a first
test with 206 response from server.

Trying to post this article via Julien's server after importing the new
X.509 certificate ...

Re: About compression with NNTP
#87221
Author: Julien ÉLIE
Date: Fri, 13 Nov 2015 19:57
29 lines
2287 bytes
Hi Michael,

> The compression bits in flnews are now implemented. I will do some loop-
> back tests first and if they should look good I am ready for a first
> test with 206 response from server.

That's great!
I'm still not ready at my end, sorry.  I'll ping you as soon as I've 
advanced a bit more.



> Trying to post this article via Julien's server after importing the new
> X.509 certificate ...

I've generated a new certificate with "-extensions usr_cert" given to 
openssl to see if it works better with Thunderbird.  Without success :-/
It does not like how the self-signed certificate is generated on my 
server.  They introduced several new checks last year but I still have 
not found out how to make it happy with my certificates...
     https://bugzilla.mozilla.org/show_bug.cgi?id=1036338

-- 
Julien ÉLIE

« Aliquis non debet esse iudex in propria causa, quia non potest esse
   iudex et pars. »

Re: About compression with NNTP
#87222
Author: Julien ÉLIE
Date: Fri, 13 Nov 2015 20:24
24 lines
2610 bytes
Hi Ken,

>> Doesn't such decoding consume too many CPU resources when thousands of
>> users are connected at the same time and massively download articles?
>
> Not sure what you mean.  The IMAP server has a view of the MIME
> structure of each message and knows what the content is and adjusts
> compression accordingly.

What I meant is that adding more analysis of the contents of the 
articles before being sent could cause performance issues.  But maybe it 
is no longer a problem with current hardware.
The analysis you suggest (finding content-types and content-encodings) 
is also lighter than what I had imagined in the first place (decoding 
the whole message, in base64 for instance, to see whether it looks like 
an already compressed binary).

-- 
Julien ÉLIE

« Aliquis non debet esse iudex in propria causa, quia non potest esse
   iudex et pars. »

Re: About compression with NNTP
#87220
Author: D. Stussy
Date: Sat, 14 Nov 2015 07:07
18 lines
2694 bytes
Note:  Although the issue of authentication before or after compression may 
be moot for other reasons based on another response, there's another issue 
to consider:  Compression is only beneficial when it results in a shorter 
transmission length than the uncompressed data.  With short commands (i.e. 
less than 30 characters), depending on the actual data and the compression 
algorithm used, the compressed version of the data is likely to be equal or 
larger -- simply because there's not enough data to make it useful - i.e. 
result in a shorter string.  I can't speak for gzip because I don't know its 
algorithm, but LZW algorithms (e.g. "deflate") do expand on a small amount 
of data, especially where there are insufficient repeating sequences for 
compression to be beneficial.

This means that sending short commands such as used in authentication make 
little sense during compression unless they are included in a much larger 
data set. 


Re: About compression with NNTP
#87224
Author: Michael Baeuerle
Date: Sat, 14 Nov 2015 11:52
37 lines
3147 bytes
D. Stussy wrote:
> 
> [...] there's 
> another issue to consider:  Compression is only beneficial when it 
> results in a shorter transmission length than the uncompressed data.  
> With short commands (i.e. less than 30 characters), depending on the 
> actual data and the compression algorithm used, the compressed version 
> of the data is likely to be equal or larger -- simply because there's 
> not enough data to make it useful - i.e. result in a shorter string.  I 
> can't speak for gzip because I don't know its algorithm, but LZW 
> algorithms (e.g. "deflate")

Note that DEFLATE/LZ77 (used in gzip) is not the same as LZW/LZ78 (used
in compress).

> do expand on a small amount of data, 
> especially where there are insufficient repeating sequences for 
> compression to be beneficial.

Quoted from RFC1951 (DEFLATE/LZ77):
| 
| A simple counting argument shows that no lossless compression
| algorithm can compress every possible input data set.  For the
| format defined here, the worst case expansion is 5 bytes per 32K-
| byte block, i.e., a size increase of 0.015% for large data sets.
                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^
0.015% would be no problem, but the stated "large data sets" are
the opposize of single, small commands.

Do sombody know the behaviour for small data sizes?
-- 
Sorry, aber mit der Einstellung würden wir heute aus Sicherheitsgründen
noch auf dem Baum sitzen. Wer etwas Neues schaffen will, muß auch was
wagen - aber da heute Kinder schon zu Fuß mit Helm rumlaufen gilt das
wohl nicht mehr...                     [Eric Brücklmeier in dse]

Re: About compression with NNTP
#87225
Author: Michael Baeuerle
Date: Sat, 14 Nov 2015 12:19
27 lines
2429 bytes
Julien ÉLIE wrote:
> Michael Bäuerle wrote:
> > 
> > Trying to post this article via Julien's server after importing the new
> > X.509 certificate ...
> 
> I've generated a new certificate with "-extensions usr_cert" given to 
> openssl to see if it works better with Thunderbird.  Without success :-/
> It does not like how the self-signed certificate is generated on my 
> server.  They introduced several new checks last year but I still have 
> not found out how to make it happy with my certificates...
>     https://bugzilla.mozilla.org/show_bug.cgi?id=1036338

flnews complains about the weak RSA key (1024 bit) in the certificate
and about weak DH parameters (1024 bit) for the key exchange. In both
cases this is the default minimum value I have configured (with smaller
sizes the negotiation would be aborted).

Maybe Mozilla want to see something stronger. IIRC they have increased
some minimum values after the "Logjam" attack was published.
-- 
Sorry, aber mit der Einstellung würden wir heute aus Sicherheitsgründen
noch auf dem Baum sitzen. Wer etwas Neues schaffen will, muß auch was
wagen - aber da heute Kinder schon zu Fuß mit Helm rumlaufen gilt das
wohl nicht mehr...                     [Eric Brücklmeier in dse]

Re: About compression with NNTP
#87226
Author: Ken Murchison
Date: Sat, 14 Nov 2015 14:38
39 lines
3378 bytes
On 11/14/2015 02:07 AM, D. Stussy wrote:
> Note: Although the issue of authentication before or after compression 
> may be moot for other reasons based on another response, there's 
> another issue to consider:  Compression is only beneficial when it 
> results in a shorter transmission length than the uncompressed data.  
> With short commands (i.e. less than 30 characters), depending on the 
> actual data and the compression algorithm used, the compressed version 
> of the data is likely to be equal or larger -- simply because there's 
> not enough data to make it useful - i.e. result in a shorter string.  
> I can't speak for gzip because I don't know its algorithm, but LZW 
> algorithms (e.g. "deflate") do expand on a small amount of data, 
> especially where there are insufficient repeating sequences for 
> compression to be beneficial.
>
> This means that sending short commands such as used in authentication 
> make little sense during compression unless they are included in a 
> much larger data set.

This is a good point.  Its possible that for most reader commands (which 
are typically short), that the client might want to set the compression 
level to 0 and only bump up the compression to a higher level for POST.

For a feeder client, the compression level can probably be left >0 all 
the time.

On the server side, I think the compression level >0 makes sense all of 
the time except when the response contains in-compressible content.

We probably need to do some analysis of "regular" reader and feeder 
traffic with compression enabled to come up with best current practices 
for compression level.

-- 
Kenneth Murchison
Principal Systems Software Engineer
Carnegie Mellon University


Re: About compression with NNTP
#87227
Author: Ken Murchison
Date: Sat, 14 Nov 2015 14:39
35 lines
3085 bytes
On 11/13/2015 05:24 AM, Michael Baeuerle wrote:
> Ken Murchison wrote:
>> On 11/12/2015 04:35 PM, Julien ÉLIE wrote:
>>> Ken Murchison wrote:
>>>> The
>>>> server is in a much better position to understand the content and is
>>>> able to adjust the compression setting on the fly within the connection.
>>> NNTP does not have the Binary content extension that IMAP has; my worry
>>> is that the server does not necessarily understand what it is sending.
>>> Otherwise, it would mean that the server performs decoding of
>>> MIME-encoded contents to see what it might be, and then adjust the
>>> compression level accordingly?
>> Why would it have to decode the MIME entity?  The server should be able
>> to tell from the Content-Type and Content-Encoding what is enclosed.
> Unfortunately MIME allows things like "nested multipart". Looking at the
> Content-Type field in the header and (if it is "multipart/*") at the
> Content-Type fields of all top-level body parts may not reveal that
> compressed content is present. Example:
>
> multipart/mixed
>     multipart/mixed
>        text/plain
>        application/gzip
>     text/plain

Correct, but in the case of IMAP servers (and my NNTP server), they 
already have a "view" of the entire MIME structure.

-- 
Kenneth Murchison
Principal Systems Software Engineer
Carnegie Mellon University


Re: About compression with NNTP
#87228
Author: Ken Murchison
Date: Sat, 14 Nov 2015 14:41
19 lines
1836 bytes
On 11/13/2015 06:44 AM, Michael Baeuerle wrote:
> Michael Baeuerle wrote:
>> Now it seems to work with TLS and AUTH too:
>> [...]
> The compression bits in flnews are now implemented. I will do some loop-
> back tests first and if they should look good I am ready for a first
> test with 206 response from server.

I just added support for COMPRESS to the Cyrus nntpd.  I will see if I 
can get the network folks on campus to allow NNTP access to our test server.


-- 
Kenneth Murchison
Principal Systems Software Engineer
Carnegie Mellon University


Re: About compression with NNTP
#87233
Author: D. Stussy
Date: Mon, 16 Nov 2015 09:24
27 lines
2787 bytes
"Michael Baeuerle"  wrote in message 
news:AABWRxtFZagAAEeU.A1.flnews@WStation4.micha.freeshell.org...
Note that DEFLATE/LZ77 (used in gzip) is not the same as LZW/LZ78 (used
in compress).
=============
I thought deflate used LZW/LZ78.  It's been 20 years since I touched 
compression anyway.
=============

Do sombody know the behaviour for small data sizes?
=============
For sufficiently small data sizes, the behavior is that the "compressed" 
version is usually LONGER than the original data.  That was my point.  It's 
because there's not enough repeating sequences.

LZW (78) performance - simplest case:
Input:  3 8-bit characters (24 bits fixed).
Output:  11 bits minimum, to 27 bits maximum.

11 bits is achieved when all three 8-bit characters are the same.  27 bits 
are when they are all different.  19 bits occurs when any two are the same 
and one is different.

In terms of bytes, 3 in can produce 2, 3, or 4 out. 


Re: About compression with NNTP
#87234
Author: Michael Baeuerle
Date: Mon, 16 Nov 2015 17:37
8 lines
1376 bytes
Michael Baeuerle wrote:
> 
> Trying to post this article via Julien's server after importing the new
> X.509 certificate ...

First test article with compression ...

Re: About compression with NNTP
#87238
Author: Julien ÉLIE
Date: Mon, 16 Nov 2015 20:32
24 lines
1970 bytes
Michael,

>> Trying to post this article via Julien's server after importing the new
>> X.509 certificate ...
>
> First test article with compression ...

Perfectly well received.  Thanks for the test!


Note for people here:  my local version of INN currently knows how to 
decompress the incoming stream, but still responds without compression. 
  Work in progress.

[C] COMPRESS DEFLATE
[S] 206 Speak to me compressed; I'll answer in clear text, though

-- 
Julien ÉLIE

« C'est comme chercher une aiguille dans du foin en bottes ! »
   (Jolitorax)

Re: About compression with NNTP
#87241
Author: Michael Baeuerle
Date: Wed, 18 Nov 2015 17:38
101 lines
4627 bytes
Julien ÉLIE wrote:
> Michael Bäuerle wrote:
> > Julien ÉLIE wrote:
> > > 
> > > Trying to post this article via Julien's server after importing the new
> > > X.509 certificate ...
> > 
> > First test article with compression ...
> 
> Perfectly well received.  Thanks for the test!

I have now taken a look at the small commands where size increases when
"Z_SYNC_FLUSH" is used between them.

Looks like it is not possible to change the compression level on-the-fly
(without destroying the whole stream and reinitialize a new one).
Have I overlooked something?

Trying to disable the compression completely (Init the compressor with
"Z_NO_COMPRESSION") still increases the size. Looks like it is not the
compression itself, but the sync bits that create the problem.

What helps is to use "Z_PARTIAL_FLUSH" instead of "Z_SYNC_FLUSH" to
push the commands out. This works too, but the state of the compressor
seems to be preserved much better. Now I see approx. factor 2 reduction
in size for a long series of "HEAD" commands:

CMPR: -------------------------------
CMPR: Accepted 12 uncompressed bytes
CMPR: Deflating...
CMPR: Flush requested
CMPR: Deflating...
CMPR: Sending 6 compressed bytes
CMPR: -------------------------------
CMPR: Accepted 12 uncompressed bytes
CMPR: Deflating...
CMPR: Flush requested
CMPR: Deflating...
CMPR: Sending 6 compressed bytes
CMPR: -------------------------------
CMPR: Accepted 12 uncompressed bytes
CMPR: Deflating...
CMPR: Flush requested
CMPR: Deflating...
CMPR: Sending 7 compressed bytes
CMPR: -------------------------------
CMPR: Accepted 12 uncompressed bytes
CMPR: Deflating...
CMPR: Flush requested
CMPR: Deflating...
CMPR: Sending 7 compressed bytes
CMPR: -------------------------------
CMPR: Accepted 12 uncompressed bytes
CMPR: Deflating...
CMPR: Flush requested
CMPR: Deflating...
CMPR: Sending 6 compressed bytes
CMPR: -------------------------------
CMPR: Accepted 12 uncompressed bytes
CMPR: Deflating...
CMPR: Flush requested
CMPR: Deflating...
CMPR: Sending 6 compressed bytes
CMPR: -------------------------------
CMPR: Accepted 12 uncompressed bytes
CMPR: Deflating...
CMPR: Flush requested
CMPR: Deflating...
CMPR: Sending 7 compressed bytes
CMPR: -------------------------------
CMPR: Accepted 12 uncompressed bytes
CMPR: Deflating...
CMPR: Flush requested
CMPR: Deflating...
CMPR: Sending 6 compressed bytes
CMPR: -------------------------------
CMPR: Accepted 12 uncompressed bytes
CMPR: Deflating...
CMPR: Flush requested
CMPR: Deflating...
CMPR: Sending 9 compressed bytes
CMPR: -------------------------------
CMPR: Accepted 12 uncompressed bytes
CMPR: Deflating...
CMPR: Flush requested
CMPR: Deflating...
CMPR: Sending 6 compressed bytes
CMPR: -------------------------------
CMPR: Accepted 6 uncompressed bytes
CMPR: Deflating...
CMPR: Flush requested
CMPR: Deflating...
CMPR: Sending 9 compressed bytes
              ^^^^^^^^^^^^^^^^^^
In some cases the size is still increased, but not very often.

For flnews, HEAD is the only command that is send many times (if OVER
capability is not available). For anything else to send that is small,
the increased size shouldn't matter.

Re: About compression with NNTP
#87242
Author: Michael Baeuerle
Date: Wed, 18 Nov 2015 17:40
17 lines
1758 bytes
Michael Baeuerle wrote:
> 
> [...]

And this was the POST command:

CMPR: -------------------------------
CMPR: Accepted 4097 uncompressed bytes
CMPR: Deflating...
CMPR: Accepted 3 uncompressed bytes
CMPR: Deflating...
CMPR: Flush requested
CMPR: Deflating...
CMPR: Sending 1271 compressed bytes
CMPR: -------------------------------

Re: About compression with NNTP
#87246
Author: Julien ÉLIE
Date: Wed, 18 Nov 2015 21:26
16 lines
1908 bytes
Michael,

> For flnews, HEAD is the only command that is send many times (if OVER
> capability is not available). For anything else to send that is small,
> the increased size shouldn't matter.

Do you try to fall back to legacy XOVER when the OVER capability is not 
advertised?  (I bet that CAPABILITIES is also not implemented in such 
servers.)

-- 
Julien ÉLIE

« Exegi monumentum aere perennius. » (Horace)

Re: About compression with NNTP
#87247
Author: Michael Baeuerle
Date: Thu, 19 Nov 2015 09:57
16 lines
1952 bytes
Julien ÉLIE wrote:
> Michael Bäuerle wrote:
> > 
> > For flnews, HEAD is the only command that is send many times (if OVER
> > capability is not available). For anything else to send that is small,
> > the increased size shouldn't matter.
> 
> Do you try to fall back to legacy XOVER when the OVER capability is not 
> advertised?  (I bet that CAPABILITIES is also not implemented in such 
> servers.)

Currently the NNTP module only supports two modes, RFC3977 and a RFC977
fallback mode for legacy servers. The things in between are not
implemented (or at least not working) yet.

Re: About compression with NNTP
#87268
Author: Michael Baeuerle
Date: Tue, 01 Dec 2015 17:38
11 lines
1510 bytes
Michael Baeuerle wrote:
> Michael Baeuerle wrote:
> > 
> > Trying to post this article via Julien's server after importing the new
> > X.509 certificate ...
> 
> First test article with compression ...

Test article with bidirectional compression ...

Re: About compression with NNTP
#87270
Author: Julien ÉLIE
Date: Tue, 01 Dec 2015 18:09
16 lines
1734 bytes
Hi Michael,

>> First test article with compression ...
>
> Test article with bidirectional compression ...

That's pretty good news!
Seems we now have proved interoperability.

-- 
Julien ÉLIE

« Pour Rome, la direction importe peu, car tous les chemins y
   mènent. » (Astérix)

Page 2 of 2 • 72 total messages
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads