Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^2: JSON::XS Bool issue in mod_perl (XS--)

by allyc (Scribe)
on Mar 01, 2013 at 20:51 UTC ( #1021336=note: print w/ replies, xml ) Need Help??


in reply to Re: JSON::XS Bool issue in mod_perl (XS--)
in thread JSON::XS Bool issue in mod_perl

Thanks Davido and Tye for your replies. I will have a look at JSON::Tiny and see if that shows the same issue.

I have just seen in the JSON documentation the following commend;

This module is not guaranteed to be thread safe and there are no plans to change this until Perl gets thread support (as opposed to the horribly slow so-called "threads" which are simply slow and bloated process simulations - use fork, it's much faster, cheaper, better).

I guess that mod_perl comes under threads due to the way that the module is reused over and over so I am not sure it's worth reporting as a bug.

if worst comes to worst I guess I could just use PP for now however some of the objects I need to encode can get quite big and will be slow but I am not sure if that will be noticeable due to the massive performance gains I get from mod_perl.

I will have to run some benchmarks next week to see which method will be the easiest. Thankfully all of the JSON code in my application is centralised so changing the JSON encoder is not a massive issue if XS will not work


Comment on Re^2: JSON::XS Bool issue in mod_perl (XS--)
Re^3: JSON::XS Bool issue in mod_perl (thread-safe)
by tye (Cardinal) on Mar 01, 2013 at 22:12 UTC

    mod_perl doesn't have to use threads (it usually doesn't, in my experience -- but "ActivePerl" might imply MS Windows which might mean Apache is more likely to be configured to use threads). Even if mod_perl uses threads, that doesn't need to mean that it lets its instances of Perl bounce between threads. So it doesn't need to mean any Perl stuff has to be thread safe.

    But I find that people are often confused about these issues (like insisting that one needs to build a threaded Perl to embed it into a threaded application, even when I know the application doesn't share Perl instances between threads). So maybe mod_perl (stupidly) shares Perl instances between threads and this causes your problem.

    - tye        

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1021336]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2014-09-03 06:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (35 votes), past polls