Perl threads and libwww wierdness

Nicholas Clark nick at ccl4.org
Tue Dec 20 08:09:15 GMT 2011


On Fri, Dec 16, 2011 at 12:38:16PM +1100, Toby Wintermute wrote:
> 2011/12/16 Peter Vereshagin <peter at vereshagin.org>:

> > (i)Threaded perl5 ( 'use threads' ) doesn't seem to be recommended for
> > production environments.
> 
> I know it certainly wasn't recommended back in the days of 5.6 or 5.8,
> but I thought things had improved since then..

Well, "they have" in that bugs have been fixed.
But the whole design, and the constraints imposed by the "API" of the core
mean that has got some fairly fundamental flaws that I don't think can
ever be fixed.

Not that Python (well, CPython) or Ruby (to the best of my knowledge) have
figured out how to retrofit proper concurrency of threads performing
computation within the VM.


> Total throughput is actually slightly faster than the threaded
> version, it uses quite a bit less memory, and critically, doesn't get
> any spurious errors.

I'm not surprised by the "less memory", but it's nice to get anecdotal
confirmation of this.


On Mon, Dec 19, 2011 at 06:31:53PM +1100, Toby Wintermute wrote:
> 2011/12/16 Peter Vereshagin <peter at vereshagin.org>:
> > Hello.
> >
> > 2011/12/16 12:38:16 +1100 Toby Wintermute <tjc at wintrmute.net> => To London.pm Perl M[ou]ngers :
> > TW> > (i)Threaded perl5 ( 'use threads' ) doesn't seem to be recommended for
> > TW> > production environments.
> > TW>
> > TW> I know it certainly wasn't recommended back in the days of 5.6 or 5.8,
> > TW> but I thought things had improved since then..
> >
> > They did. Perl6 was released and it seems to have threads those can be recommended.
> > Perl5 have fork() that 'just works' and seems to be enough.
> 
> So, you're saying that threads under perl5 is forever going to be
> considered broken and not worth touching then? :(

I think he did. Strictly all I can say is "I can't see how to fix it"
and if I make such statements without any further qualification then it's
always also implied "and I've thought about this for a while"

[contrast with
 http://onefte.com/2011/11/04/taking-the-rough-estimation-oath/ ]

> Why do all the main distros ship a threading-enabled Perl? I note that
> Padre won't build without threads enabled either.

Remember that the default config is no threads, and no "shared perl library".

1: You seem to be assuming that distros actually know what they are doing
   when it comes to perl
   [IIRC Mandriva *stopped* defaulting to threads at some point while Rafael
    Garcia-Suarez was working there. There. One example is proof :-)]
2: Distros don't like to ship more than copy of perl. They see that ithreads-
   enabled perl "supports" everything that the default config does. Likewise
   "shared perl library" means that anything embedding perl (eg mod_perl)
   takes less space. So they seem to tweak both of these from the defaults

Nicholas Clark


More information about the london.pm mailing list