Hello Neighbour,
For some reason I cannot reply directly to your last message. Here is the html that would run my code:
<html> <head> <script type="text/javascript" src="http://localhost/jquery-1.6.1.min. +js"></script> <script> function init() { var options = { type: "POST", url: "http://localhost/testSharing", }; for(var i = 0; i < 100; i++) $.ajax(options); } $(document).ready(init); </script> </head> <body> </body> </html>
This is assuming that you place your jquery source at the root (the file is named jquery-1.6.1.min.js). You can download jquery from http://jquery.com/. I am not sure what the package is that you installed. Javascript files are simple text files with code that you can place directly in your document root.
Also don't forget to update your apache2.conf file with the <IfModule mpm_worker_module> etc. This will force Apache to process requests in a single process, which you should see when you look at the log file outputted by the handler. There should only be one number in the process ID field.
Pressing F5 with your finger is simply not fast enough, which is why we need the javascript code to pound the server with several requests simultaneously so that we force it to use at least two threads at the same time. That's why you also need to pay attention to the output in the log file I created. The process ID should be the same (threads::shared cannot share a variable across processes; testing it across multiple process does not make sense). Then, you should see different thread IDs as well. Ideally, there is only one Initializing statement even if several threads access the shared variable. My problem is that I get multiple Initializing statements even when all requests are processed in one process and multiple threads answer. Note that during my testing I had cases where some new threads did not output Initializing... but others did. So it looked to me like the sharing of the variable worked sometimes and other times it did not. I would like to understand why.
Anyway, I am excited to hear whether you can reproduce my results as well. Don't forget to update apache2.conf and let me know how the javascript works for you.
Sincerely,
Pawel
In reply to Re^4: 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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |