Forum .LRN Q&A: Re: Cluster and performance

Collapse
Posted by Jose Agustin Lopez Bueno on
Hello again!

At last I have detected where is the problem:

The function is
  site_node::get_from_object_id
in
  packages/acs-tcl/tcl/site-nodes-procs.tcl
  (the source is below)

This function is VERY,VERY slow and inefficient
when the number of objects is big.
Its behavior implies to all the application.

Please, if you can give a pointer to modify the
code, please email me.

Source code:

***************************************************
    site_node::get_url_from_object_id__arg_parser

    set sort [list]
    foreach url [nsv_array names site_nodes] {
        ns_log Notice $url
        lappend sort [list $url [string length $url]]
    }

    set sorted [lsort -index 1 $sort]

    foreach elm $sorted {
        set url [lindex $elm 0]
        array unset site_node
        array set site_node [site_node::get_from_url \
          -url $url]
        if { $site_node(object_id) == $object_id } {
            return $url
        }
    }

    return {}

    return [db_list select_url_from_object_id {}]
***************************************************

Subscript: What do the second return? Or is a mistake?

Best regards,
Agustin