perl - How can I determine PerlLogHandler performance impact? -


I want to create a custom Apache2 log handler, and templates found on the Apache site:

  #file: MyApache2 / LogPerUser.pm # --------------------------- Package MyApache2 :: LogPerUser; Strict use; Use warnings; Use Apache2 :: RequestRec (); Use Apache 2 :: Connection (); Use Fcntl qw (: bunch); File :: spec :: functions use qw (catfile); Apache 2 :: Conte-compile = & gt; Use cude (fine) sub handler {my $ r = shift; My ($ username) = $ r- & gt; Uri = ~ m | ^ / ~ ([^ /] +) | | $ Apache2 :: Const :: Denied until defined $ user name; My $ entry = sprintf qq (% s [% s] "% s"% d% d \ n), $ r-> Connection- & gt; Remote_ype, scaler (local time), $ r->, uri, $ r - & gt; Position, $ r-> Bytes_sent; My $ log_path = catfile Apache 2: ServerUtil :: Server_Rote, "Log", "$ username.log"; Open your $ FH, "> $ log_path" or "$ log_path: $! Can not open";; Swarm $ FH, LOCK_EX; Print $ fh $ entry; About $ FH; Return Apache2 :: Const :: Ok; } 1;  

What is the cost of sheep display? Is this logging process done in parallel, or with the HTTP request in the serial? Display will not make any difference in parallel, but I would not want the user to wait to add any other split seconds in such a way.

Instead of worrying too much about what the cost may be, just try it out and find out .

First of all, using your current configuration by using ab , the benchmark or torture tester of your favorite webserver, many people forget this first step.

Next, apply your change and try again. Compare the results.

Some links that can help may be of short time, but the basics are the same:

  • < Remember also, that you can do the stuff after you serve the response when the customer is waiting for the response, then you do not have to do everything and, Code> Swarm does not sweat too much. If you do not like them, then there are many other ways around it, including:

    • Write and merge into a separate file for each child
    • < Li> Send a message to a single
    • Setting up a custom log format and letting Apache handle it
    • / ul> < / Div>

Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -