Advertisement:

Author Topic: Osclass Memory Usage and Caching  (Read 12901 times)

Web-Media

  • Sr. Member
  • ****
  • Posts: 453
  • Web
Re: Osclass Memory Usage and Caching
« Reply #120 on: May 16, 2015, 04:43:30 pm »
Forgot to mention :
 
Code: [Select]
public function replace($key, $value, $section = 'osclass', $type = 'STRING') {
        static $aValidEnumTypes = array('STRING', 'INTEGER', 'BOOLEAN');
        $array_replace = array(
            's_name' => $key,
            's_value' => $value,
            's_section' => $section,
            'e_type' => in_array($type, $aValidEnumTypes) ? $type : 'STRING'
        );
 // upgrade  preferences
        $this->set($key, $value, $section, $type = 'STRING');
        return $this->dao->replace($this->getTableName(), $array_replace);
    }

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: Osclass Memory Usage and Caching
« Reply #121 on: May 16, 2015, 09:58:31 pm »
I have a break now... :D

Quote
$pref =   Preference::newInstance();
$pref2 =  new Preference();

What would be the use of creating another Preference object when the existent already contains all data? ??? And if really needed, you could just clone the current one.

Code: [Select]
Preference::newInstance()->listAll();
This is a DAO (mother class of Preference) method used by a lot of DAO subclasses, and again I don't see the point of using it. ???

Code: [Select]
Preference::newInstance()->findBySection('my_section');
Ok, you need to query the DB to obtain just the whole set of preferences of your plugin. When do you need that? On plugin configuration by Admin, once in while. No real saving here.

But talking about Preferences, here's a thought: Why are they all loaded at once at all? Vanilla "osclass" section, that makes sense, but why do I need 80000+ characters in a badwords list for SpamKiller plugin in homepage, search page, etc? Even item post/edit form pages don't require that, they are needed only in their aftermath and only there. That's more than a half of the total size of my Preferences,  :o so I'd rather save those 80-100K retrieved from the database each time any page is requested.

Anyway, all this is peanuts, your remark about indiscriminate loading of most of the classes on oc-load, that's the key. We don't need phpmailer until a mail is about to be sent, nor Admin related ones if it's a common user who is browsing, and so on.

Also, it would help a more selective loading of plugins. What use has, for instance, your brand new Benchmark plugin to the common user to be loaded every time he/she request a page? ???

Indeed there is much to cut here yet, we keep praying and hope the gods hear us some day. :D

Regards

SmaRTeY

  • Osclass Hero
  • Hero Member
  • *
  • Posts: 2519
Re: Osclass Memory Usage and Caching
« Reply #122 on: May 17, 2015, 01:56:29 am »
I am glad you guys are already that deep into Osclass and it's architecture!

Main thing here is that we all understand the importance of 'vanilla' and we challenge Osclass devs to keep improving.
I would like to hear what Osclass devs have to say...... ::)

Web-Media

  • Sr. Member
  • ****
  • Posts: 453
  • Web
Re: Osclass Memory Usage and Caching
« Reply #123 on: May 17, 2015, 05:07:53 am »
« Last Edit: May 17, 2015, 05:14:18 am by Web-Media »

SmaRTeY

  • Osclass Hero
  • Hero Member
  • *
  • Posts: 2519
Re: Osclass Memory Usage and Caching
« Reply #124 on: May 17, 2015, 11:38:39 pm »
I saw it, cool analysis but I htink you need to take it one more level deeper.....see if you can break-down Preference class call  ::)

Aficionado

  • Guest
Re: Osclass Memory Usage and Caching
« Reply #125 on: May 27, 2015, 02:18:32 am »
Today i checked my resource usage after enabling 64 mb of Opcache in my plan. It seems that the CPU usage is a lot lower and my Physical Memory increased a bit. I don't see any changes in i/o or php entry processes.

Strange thing is that cpu remains at 25% and up, no less.


See the last 30 days capture. The red vertical line is when i enabled Opcache.

« Last Edit: May 27, 2015, 02:21:11 am by Aficionado »