[prev in list] [next in list] [prev in thread] [next in thread] 

List:       apache-modperl
Subject:    Re: HTTP and MPM support
From:       John Dunlap <John () lariat ! co>
Date:       2019-01-29 21:53:58
Message-ID: CAC5eUStuK1yDZxz_EZCT9RtSHDRYJF8nFrjWoANK=P8QzOLshQ () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


We use Redis to share information between mod_perl processes(including our
HTTP sessions). This has the added advantage of allowing all servers in a
cluster to share the same session/cache.

On Tue, Jan 29, 2019 at 7:38 PM Narbey Derbekyan <narbey@gmail.com> wrote:

> We've used Cache::FastMmap at my work to share data between mod_perl
> processes. We did not consider using threads because they're not
> lightweight.
> What the rules you guys are following when it comes to using threads?
>
> On Tue, Jan 29, 2019 at 9:48 AM John Deighan <john.deighan@gmail.com>
> wrote:
>
>> We also use threads without any problem in production. Main use is
>> sharing caches so that multiple mod_perl interpreters don'teach store the
>> same cached information. Following a few simple and documented rules, we've
>> had no issues with using threads.
>>
>> On Mon, Jan 28, 2019 at 6:18 PM Mark Blackman <mark@blackmans.org> wrote:
>>
>>>
>>>
>>> > On 28 Jan 2019, at 23:00, Paul B. Henson <henson@acm.org> wrote:
>>> >
>>> > On 1/28/2019 1:53 PM, Mark Blackman wrote:
>>> >> https://perldoc.perl.org/threads.html#WARNING  Threads are
>>> discouraged in Perl these days
>>> >
>>> > Yes, that is indeed what the documentation says; however, there is a
>>> far cry between "Perl is single-threaded by design and history and has no
>>> reliable support for threading" and "use of threads is discouraged in perl".
>>> >
>>> > Looking back to the original discussion that led to that caveat
>>> https://www.nntp.perl.org/group/perl.perl5.porters/2014/03/msg213382.html
>>> a good summary of why it is there is:
>>> >
>>> > "The patch came about because unmanaged expectations of support are
>>> causing social problems"
>>> >
>>> > And further discussion about it
>>> https://www.perlmonks.org/?node_id=1107534 has a similar insight:
>>> >
>>> > "that this particular formulation is just smoke and mirrors to repel
>>> 'annoying newbies"
>>> >
>>> > Then in this bug discussing the verbiage
>>> https://rt.perl.org/Public/Bug/Display.html?id=133021 a developer
>>> comments:
>>> >
>>> > "The fact is that threads work, they are maintained, and they
>>> currently do not have any bugs preventing their use."
>>> >
>>> > Basically, perl threads are heavyweight, not lightweight, and use of
>>> non-thread safe Perl code whether your own or in third-party modules will
>>> cause potentially nondeterministic problems. The warning is basically there
>>> to scare away people who don't have sufficient expertise to make it work
>>> and will likely come complain and ask for help with something the
>>> developers don't want to have to explain over and over again.
>>> >
>>> > Back when I was running DCE/DFS and maintaining the perl modules on
>>> top of that, I used threaded perl heavily with no issues. As long as the
>>> mechanism of and caveats regarding Perl threads are understood, and there
>>> is a justifiable reason to be using them rather than some other construct,
>>> discouraged is not deprecated nor unavailable/unreliable.
>>>
>>> "Threads are implemented in a way that make them easy to misuse." ==
>>> "single threaded by design" in my book, but your mileage may vary. I
>>> believe threads were retrofitted to Perl and I see very little use of
>>> threads in the wild myself. Relying on threads in Perl with real-world
>>> third-party XS modules that aren't thread-safe is equivalent to unreliable.
>>> Base Perl might be safe enough, but nobody runs real-world apps with pure
>>> Perl alone IME.
>>>
>>> I am glad you made threads work well in production, but I suspect you're
>>> in a minority.
>>>
>>> - Mark
>>>
>>>
>>>
>>>

-- 
John Dunlap
*CTO | Lariat *

*Direct:*
*john@lariat.co <john@lariat.co>*

*Customer Service:*
877.268.6667
support@lariat.co

[Attachment #5 (text/html)]

<div dir="ltr">We use Redis to share information between mod_perl processes(including \
our HTTP sessions). This has the added advantage of allowing all servers in a cluster \
to share the same session/cache.<br></div><br><div class="gmail_quote"><div dir="ltr" \
class="gmail_attr">On Tue, Jan 29, 2019 at 7:38 PM Narbey Derbekyan &lt;<a \
href="mailto:narbey@gmail.com">narbey@gmail.com</a>&gt; wrote:<br></div><blockquote \
class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex"><div dir="ltr"> <div>We&#39;ve used 
<span>Cache::FastMmap</span> at my work to share data between mod_perl processes. We \
did not consider using threads because they&#39;re not lightweight.</div><div>What \
the rules you guys are following when it comes to using threads?</div>

</div><br><div class="gmail_quote"><div dir="ltr" \
class="gmail-m_-4548720973135889471gmail_attr">On Tue, Jan 29, 2019 at 9:48 AM John \
Deighan &lt;<a href="mailto:john.deighan@gmail.com" \
target="_blank">john.deighan@gmail.com</a>&gt; wrote:<br></div><blockquote \
class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex"><div dir="ltr">We also use threads without any \
problem in production. Main use is sharing caches so that multiple mod_perl \
interpreters don&#39;teach store the same cached information. Following a few simple \
and documented rules, we&#39;ve had no issues with using threads.</div><br><div \
class="gmail_quote"><div dir="ltr" \
class="gmail-m_-4548720973135889471gmail-m_-8037992889690258583gmail_attr">On Mon, \
Jan 28, 2019 at 6:18 PM Mark Blackman &lt;<a href="mailto:mark@blackmans.org" \
target="_blank">mark@blackmans.org</a>&gt; wrote:<br></div><blockquote \
class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex"><br> <br>
&gt; On 28 Jan 2019, at 23:00, Paul B. Henson &lt;<a href="mailto:henson@acm.org" \
target="_blank">henson@acm.org</a>&gt; wrote:<br> &gt; <br>
&gt; On 1/28/2019 1:53 PM, Mark Blackman wrote:<br>
&gt;&gt; <a href="https://perldoc.perl.org/threads.html#WARNING" rel="noreferrer" \
target="_blank">https://perldoc.perl.org/threads.html#WARNING</a>   Threads are \
discouraged in Perl these days<br> &gt; <br>
&gt; Yes, that is indeed what the documentation says; however, there is a far cry \
between &quot;Perl is single-threaded by design and history and has no reliable \
support for threading&quot; and &quot;use of threads is discouraged in \
perl&quot;.<br> &gt; <br>
&gt; Looking back to the original discussion that led to that caveat <a \
href="https://www.nntp.perl.org/group/perl.perl5.porters/2014/03/msg213382.html" \
rel="noreferrer" target="_blank">https://www.nntp.perl.org/group/perl.perl5.porters/2014/03/msg213382.html</a> \
a good summary of why it is there is:<br> &gt; <br>
&gt; &quot;The patch came about because unmanaged expectations of support are causing \
social problems&quot;<br> &gt; <br>
&gt; And further discussion about it <a \
href="https://www.perlmonks.org/?node_id=1107534" rel="noreferrer" \
target="_blank">https://www.perlmonks.org/?node_id=1107534</a> has a similar \
insight:<br> &gt; <br>
&gt; &quot;that this particular formulation is just smoke and mirrors to repel \
&#39;annoying newbies&quot;<br> &gt; <br>
&gt; Then in this bug discussing the verbiage <a \
href="https://rt.perl.org/Public/Bug/Display.html?id=133021" rel="noreferrer" \
target="_blank">https://rt.perl.org/Public/Bug/Display.html?id=133021</a> a developer \
comments:<br> &gt; <br>
&gt; &quot;The fact is that threads work, they are maintained, and they currently do \
not have any bugs preventing their use.&quot;<br> &gt; <br>
&gt; Basically, perl threads are heavyweight, not lightweight, and use of non-thread \
safe Perl code whether your own or in third-party modules will cause potentially \
nondeterministic problems. The warning is basically there to scare away people who \
don&#39;t have sufficient expertise to make it work and will likely come complain and \
ask for help with something the developers don&#39;t want to have to explain over and \
over again.<br> &gt; <br>
&gt; Back when I was running DCE/DFS and maintaining the perl modules on top of that, \
I used threaded perl heavily with no issues. As long as the mechanism of and caveats \
regarding Perl threads are understood, and there is a justifiable reason to be using \
them rather than some other construct, discouraged is not deprecated nor \
unavailable/unreliable.<br> <br>
&quot;Threads are implemented in a way that make them easy to misuse.&quot; == \
&quot;single threaded by design" in my book, but your mileage may vary. I believe \
threads were retrofitted to Perl and I see very little use of threads in the wild \
myself. Relying on threads in Perl with real-world third-party XS modules that aren't \
thread-safe is equivalent to unreliable. Base Perl might be safe enough, but nobody \
runs real-world apps with pure Perl alone IME.<br> <br>
I am glad you made threads work well in production, but I suspect you're in a \
minority.<br> <br>
- Mark<br>
<br>
<br>
<br>
</blockquote></div>
</blockquote></div>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" \
class="gmail_signature"><div dir="ltr"><div \
style="font-size:small;font-family:arial"><span \
style="color:rgb(68,68,68);font-family:&quot;trebuchet \
ms&quot;,sans-serif;font-size:large">John Dunlap</span><br></div><div \
style="font-size:small;font-family:arial"><i style="font-family:&quot;trebuchet \
ms&quot;,sans-serif"><span \
style="color:rgb(153,153,153);font-family:tahoma,sans-serif;font-style:normal">CTO |  \
</span><span style="font-family:tahoma,sans-serif;font-style:normal"><font \
color="#ff9900">Lariat</font></span><span \
style="color:rgb(153,153,153);font-family:tahoma,sans-serif;font-style:normal">  \
</span></i><br></div><div style="font-size:small;font-family:arial"><i \
style="font-family:&quot;trebuchet ms&quot;,sans-serif"><span \
style="color:rgb(153,153,153);font-family:tahoma,sans-serif;font-style:normal"><br></span></i></div><div \
style="font-size:small;font-family:arial"><i style="font-family:&quot;trebuchet \
ms&quot;,sans-serif"><span \
style="color:rgb(153,153,153);font-family:tahoma,sans-serif;font-style:normal"><b>Direct:</b></span></i></div><div \
style="font-size:small;font-family:arial"><i style="font-family:&quot;trebuchet \
ms&quot;,sans-serif"><span \
style="color:rgb(153,153,153);font-family:tahoma,sans-serif;font-style:normal"><a \
href="mailto:john@lariat.co" style="color:rgb(17,85,204)" \
target="_blank">john@lariat.co</a></span></i></div><div \
style="font-size:small;font-family:arial"><i style="font-family:&quot;trebuchet \
ms&quot;,sans-serif"><span \
style="color:rgb(153,153,153);font-family:tahoma,sans-serif;font-style:normal"><br><b>Customer \
Service:</b></span></i></div><div style="font-size:small;font-family:arial"><span \
style="color:rgb(153,153,153);font-family:arial,helvetica,sans-serif"><a \
value="+18772686667" style="color:rgb(17,85,204)">877.268.6667</a></span></div><div \
style="font-size:small;font-family:arial"><span \
style="color:rgb(153,153,153);font-family:arial,helvetica,sans-serif"><a \
href="mailto:support@lariat.co" style="color:rgb(17,85,204)" \
target="_blank">support@lariat.co</a></span></div><div \
style="font-size:small;font-family:arial"><img \
src="cid:ii_hwm90qu91_146b4d583171a8e6" width="100" height="60"></div></div></div>

--0000000000004eb58405809fd564--


["100x60.png" (image/png)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic