Hello Neighbour,

Here is the javascript code:

function init() { var options = { type: "POST", url: "testSharing", }; for(var i = 0; i < 100; i++) $.ajax(options); } $(document).ready(init);

You need to download jQuery so that this code works but you can also create equivalent code that does not use jQuery and that does the same thing. At least you have the idea of what I am doing.

As far as permissions go:

sudo chown www-data:www-data /testSharing.log sudo chmod 660 /testSharing.log

will do the trick.

In your case, you are running multiple processes, as you can see in your log output (the four digit number before the hyphen after the milliseconds field). In order to force Apache to run as a single process with multiple threads, you need to change the config in apache2.conf by adding/changing:

<IfModule mpm_worker_module> StartServers 1 MinSpareThreads 5 ThreadsPerChild 20 MaxRequestsPerChild 0 ServerLimit 1 PerlInterpMax 1 </IfModule>

Also, install the worker mpm by running:

sudo apt-get install apache2-mpm-worker

Then, you will only have a single process and multiple threads, as you will clearly see when you run the javascript above and check the log file.

I hope someone can help me with this problem. Still not clear why multiple instances are initialized.

Sincerely,

Pawel


In reply to Re^3: Threaded MPM Sharing Variables (this time with complete test code) by busymeister
in thread Threaded MPM Sharing Variables (this time with complete test code) by busymeister

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.