In a message dated 1/27/2003 12:32:51 PM Eastern Standard Time, [EMAIL PROTECTED] writes:

sorry, there is no $ sign in the actual code.
 
So, is it worth trying to substitute ns_share with nvs stuff (nsv_set &nsv_get) to see if the problem goes away ?
 
Thanks,
Seena


I would definitly recommend using nsv's instead of ns_share variables, especially if you are running Tcl 8.x. For your application, you'll probably want to take a look at the nsv_incr command specifically.

Here's another tip which can help when dealing with lock contention. First, make sure you are creating named mutex locks:

ns_mutex create counter

Second, enable mutex metering in your AOLserver configuration. Be aware that this causes some additional lock contention itself, so I'd recommend only enabling this in a development environment:

ns_section "ns/threads"
ns_param mutexmeter on

Lastly, with mutex metering enabled, you can use the "ns_info" command from the control port or an .adp page to find out what locks are causing the most contention. The latest AOLserver 3.5.x release contains a web based stats interface that displays this information. Here's a little script which essentially does the same thing:

set results
"NAME(ID): #LOCK, #BUSY, CONTENTION\n"

foreach lock [ns_info locks] {
    foreach {name owner id nlock nbusy} $lock {
        if {$nbusy ==
0} {
            set contention
0.0
        } else { 
            set contention [expr double($nbusy*
100.0/$nlock)]       
        }   
    }   
    append results
"${name}(${id}): ${nlock}, ${nbusy}, ${contention}%\n"
}

return $results

Hope this helps!

- Nathan

Reply via email to