Welcome Guest, Not a member yet? Register   Sign In
Model::_assign_libraries takes up to 20 times longer to run on a different server
#1

[eluser]Nate Wagar[/eluser]
Okay, here's the deal:
I have two servers: a local test box, and a remote test box. Since the local test box is my own computer, it runs on top of Windows XP, with the WinNT MPM, while the remote test box runs on Solaris 10, with PreFork MPM. Other than that, though, the two instances are very similar - both run Apache 2.2.9, with PHP 5.2.6. The only major difference in the config files is the inclusion of mod_dtrace on the remote server.

Since the remote server is a small cluster of pretty recent Sun servers, I don't believe the issue is in my desktop being a more powerful machine.

In the scope of my application, however, this is where the similarities end. The chunk of code below takes 0.2-0.5ms to run locally, and 4-6ms to run remotely. Since the number of models on a page in my app increases exponentially, this quickly becomes a problem with larger datasets.

Code:
function _assign_libraries($use_reference = TRUE)
    {
        $CI =& get_instance();
        
        //$time = microtime();
        foreach (array_keys(get_object_vars($CI)) as $key)
        {
            if ( ! isset($this->$key) AND $key != $this->_parent_name)
            {
                // In some cases using references can cause
                // problems so we'll conditionally use them
                if ($use_reference == TRUE)
                {
                    $this->$key = NULL; // Needed to prevent reference errors with some configurations
                    $this->$key =& $CI->$key;
                }
                else
                {
                    $this->$key = $CI->$key;
                }
            }
        }
        //if (get_class($this) == 'SeatType')
        //echo sprintf('%.5f us|', (microtime() - $time));
    }

Does anyone have any ideas as to why this is happening? It seems like it's likely a server issue, but I thought that I might check here first.

Thanks!
#2

[eluser]Nate Wagar[/eluser]
As it turns out, I may have been following a ghost here - the overhead on the remote server is from arithmetic surrounding microtime(if anyone can explain this, I would really appreciate it.)




Theme © iAndrew 2016 - Forum software by © MyBB