CRM Open Source Business & Social CRM Software

Page 1 of 10 12345 ... LastLast
Results 1 to 10 of 97

Thread: Ongoing Performance Work...

  1. #1
    Jacob's Avatar
    Jacob is offline Senior Member
    Join Date
    Oct 2004
    Posts
    331

    Default Ongoing Performance Work...

    Sugar is very committed to ensuring that you get top performance out of the system. Several months ago, we instituted a policy of doing a performance sanity check before every release. We run some base cases in the old version and the new version to make sure that the performance line is held steady or improved.

    Recently, we have been working on more aggressive measures to improve performance. While many of these have been shared in the forums, we are documenting these performance improvements in more detail and will make that available soon. There are currently many ways to boost the performance of the system with little or no changes to the end user UI.

    The forums have also been a great source of feedback on the performance of the product and your active participation has helped us isolate and remove slow areas of the application.

    Some of the third party modules included in Sugar definitely contribute to the amount of processing required to render the application. Where we can identify these components, we provide alternatives as quickly as we can. One example is the JSON encoding that is done in PHP code. It turns out that character by character encoding and encryption is not one of PHP's strong suits. One of the performance tweaks is to load a PHP module that performs the encoding in C++. This results in a roughly 50% decrease in the total response time required to render the list and detail views.

    We are definately working on improving the performance, stability, and scalability of the application. I am very interested in any feedback on where things are slow, what could be improved, what is working, and where you have seen improvements.

    Below are some of the available settings that improve the performance of Sugar installations. I will follow up this post with some configuration guidelines for Apache and PHP.

    Jacob

    Here is a quick list of the high level performance tweaks. Many of these are OOB in 4.2.0x but several have been back ported to 4.0.x.

    JSON Encoding Module



    • Mentioned in PHP Configuration. Offloads a lot of CPU from Web Server Platform Requirements
    Version 4.2.0+ will automatically leverage a JSON module. For 4.0.x, please change the top of the encode function in include/JSON.php:

    function encode($var)
    {
    //START JSON MODULE ADDED CODE
    // use php-json c library extension if available [ http://aurore.net/projects/php-json/ ]
    static $function_exists = null;
    if(!isset($function_exists))
    {
    $function_exists = function_exists('json_encode');
    }

    if($function_exists) return json_encode($var);
    //END JSON MODULE ADDED CODE

    switch(gettype($var)) {


    Drop the absolute totals from list views


    • Users see record count 1-20 of 21+ instead of 1-20 of 12984832.
    • Most users don't care.
    • Major improvement in DB performance
    Configuration change in config.php or config_override.php:

    'disable_count_query' => true,


    Disable DetailView VCR Control (4.2.1+)


    • Removes the ability to page through records from the detail vaiew.
    • Very few users even know this functionality exists
    • Removes the cost of a listview from the DetailView
    Configuration change in config.php or config_override.php:

    'disable_vcr' => true,


    Collapse Unused Sub-Panels


    • Greatly Decreases Processing Required to Render the Page.
    • We don't retrieve information for hidden sub-panels. Users can expand them as they desire.
    Configuration change in config.php or config_override.php:

    // Always hide subpanels when a user views a detail record
    $sugar_config['hide_subpanels'] = true;
    //When a user first visits a detail view hide all subpanels for a
    module. Then whatever subpanels are opened in that module stay open
    throughout the session regardless of what the record id is.
    $sugar_config['hide_subpanels_on_login'] = true;


    Don't Automatically Repeat Previous Query on List Views


    • This change requires users to hit the search button or perform some other action for the list view to populate records.
    • Typically the results of the previous search would be the wrong data anyways.
    • Unfiltered seraches are really expensive and show the first 20 records of possibly millions.
    Configuration change in config.php or config_override.php:

    'save_query' => 'populate_only',


    Use a PHP Session Cache

    • Saving and loading sessions can take a lot of time. Storing the sessions in memory or on a RAM disk can definately decrease some of the disk IO wait times in the application. Cluster aware PHP accelerators can store sessions in memory without loss of high availability.
    Last edited by Jacob; 2006-07-14 at 09:42 PM.

  2. #2
    Jacob's Avatar
    Jacob is offline Senior Member
    Join Date
    Oct 2004
    Posts
    331

    Default Re: Ongoing Performance Work...

    Configuration Guidelines for Apache and PHP:

    Apache Setup

    Apache Configuration Recommendations:





    • In the configuration for your Sugar root folder:
      • AllowOverride All
    Configure the Maximum number of clients to prevent the box from swapping under high load. Set max clients to roughly the number of full pages that your server can work on concurrently (roughly the same as the number of virtual CPUs). The following is a portion of the apache configuration file httpd.conf with some of the setting relevant to Sugar. You should not include any of the content on the line from the '--' on. These are just comments.

    in <IfModule prefork.c>

    • StartServers 8 -- The number of server instances to start when Apache is started
    • MinSpareServers 5 -- The minimum number of servers to have waiting for new connections
    • MaxSpareServers 20 -- The maximum number of servers to have waiting for new connections. This setting tells Apache when to start cleaning up extra servers. It helps free memory up after a period of high load.
    • ServerLimit 50 -- The maximum number of servers to have at any point. This setting helps keep Apache memory under control. You can only have this many servers running at any time.
    • MaxClients 12 -- The maximum number of concurrent requests. This setting is used to prevent the server from being crushed by high load. It causes more concurrent requests to be queued up.
    • MaxRequestsPerChild 1000 -- The maximum number of requests that a spawned Apache process can process before it should be destroyed and replaced with a new one. This setting helps prevent long term memory fragmentation.
    PHP Setup

    PHP can either be compiled locally or downloaded from one of many websites. If compiling locally, see the list of required modules below. For standard distributions of PHP, you might want to consider one of the Zend Core products (i.e. Zend Core for Oracle) or one of the stack distributions.

    PHP Configuration Recommendations:

    Below is a collection of lines from php.ini along with the recommended setting and a description of what the setting does.


    • register_globals = Off ; Security -- Having register globals set to off makes it much harder to attack your
    • instancemagic_quotes_gpc = On ; Automatically quotes incoming arguments
    • output_buffering = On ; Build entire response before sending to client
    • zlib.output_compression = On ; Turn on compression of page
    • responsesallow_call_time_pass_reference = Off ; This is the depricated message
    • upload_max_filesize=40M ; Maximum size of file uploads
    • max_execution_time=60 ; Maximum execution time of each script, in seconds
    • max_input_time = 60 ; Maximum amount of time each script may spend parsing request
    • datamemory_limit=350M ; Maximum amount of memory a script may consume
    • log_errors = On ; Log errors to the PHP error log.error_reporting = E_ALL & ~E_NOTICE ; Suppress notices in production
    • open_basedir = '/var/www/html:/tmp' ; Restrict PHP to only allow it to access the session save path and web root. For general systems it is a good idea to use the open_basedir restriction. It prevents security vulnerabilities in any PHP application or uploaded PHP file from allowing people to pull personal or confidential information off of your machine. With the restriction to the temp folder and the web server root folder, PHP programs running on the server can get to anything inside the web root or temp folder. It is a very good idea to run your web server as a restricted user and limit that user's access to critical files and resources.
    PHP Modules:




    • mbstring (--enable-mbstring)
    • xmlrpc (--with-xml)
    • pear (--with-pear)
    • cURL (--with-curl)
    • openssl (--with-openssl)
    • json (third party module) -- Massive improvements in JSON encoding speed. Highly recommended.
    Database Specific Connectors: (required to connect to the specified database)


    • mysql (--with-mysql) (for MySQL connectivity)
    • OCI8 (latest version for Oracle Connectivity) For Oracle connectivity an oracle client is also required.
    For Inbound Email support (POP3 or IMAP):


    • imap 2004i (--with-imap)
    • imap-ssl (--with-imap-ssl=/path/to/openssl)
    PHP Module to Accelerate JSON:

    Loading a JSON module greatly improves the performance of Sugar from version 4.2 on (we also have a patch for 4.0.1 that will improve the performance the same amount). The particular extension that we tested the speed boost with was: http://aurore.net/projects/php-json/

    Installation Steps:

    1. Download http://aurore.net/projects/php-json/...-1.2.0.tar.bz2
    2. ./configure, make, make install
    3. move .so file from where it was install to php extension directory (The make program should automatically copy it to the extensions folder if it is using a standard location. If it does not, your extension directory is specified in the php.ini file by the extension_dir setting)
    4. the new extension is called json.so. Add a line to php.ini
    extension=json.so The Sugar Application will automatically start using the module once it is available
    Last edited by clint; 2006-07-14 at 09:48 PM.

  3. #3
    EdSawyer is offline Sugar Community Member
    Join Date
    Jan 2006
    Posts
    35

    Default here's another problem.

    I just discovered this one...

    setting this flag in the config file breaks the mass-update functionality;


    'save_query' => 'populate_only',

    doing so prevents opportunities, accounts, leads, etc. from being reassigned to different users. the mass update will still change some fields (in our case, things like opportunity type), but it won't allow reassignment of assigned_user or team_id.

    Any ideas on a fix?

    -Ed

  4. #4
    Jacob's Avatar
    Jacob is offline Senior Member
    Join Date
    Oct 2004
    Posts
    331

    Default Re: Ongoing Performance Work...

    I have filed a bug: 7248

    Hopefully we can get a few minutes from the engineer that wrote that piece.

    Jacob
    Last edited by Jacob; 2006-07-18 at 05:12 PM.

  5. #5
    EdSawyer is offline Sugar Community Member
    Join Date
    Jan 2006
    Posts
    35

    Default Re: Ongoing Performance Work...

    Thanks for filling that - I filed one too. Looks like it was fixed, or at least the bug report says so... fixed in 4.2.1b - now just have to wait for that I suppose. ;-)

    thanks
    -Ed

  6. #6
    sylvaindoc is offline Sugar Community Member
    Join Date
    Mar 2006
    Posts
    34

    Default Re: Ongoing Performance Work...

    Hello there,
    I'm trying to get the json extension working with php5 and sugar on a windows box.
    I downloaded the dll for php 5.1.2 at http://aurore.net/projects/php-json/, and it's working with PHP.
    Unfortunately this is the 1.2.1 version of json and it's not working with Sugar.
    Where can I find the 1.1.1 version for Windows?
    Cheers,
    Sylvain

  7. #7
    ruchida's Avatar
    ruchida is offline A Sugar Hero | Help Forum Moderator
    Join Date
    Feb 2005
    Location
    Japan
    Posts
    1,372

    Default Re: Ongoing Performance Work...

    Ryuhei Uchida
    CEO, OpensourceCRM, Inc
    SugarCRM Gold Reseller Partner
    Help Forum Moderator
    Calendar 2.0
    http://blogs.itmedia.co.jp/ruchida/

  8. #8
    stevec is offline Sugar Community Member
    Join Date
    Oct 2005
    Location
    London
    Posts
    1,100

    Default Re: Ongoing Performance Work...

    Checking if json is working:

    Hi,

    I've set up json on our linux box (json 1.2.1) - and it reports as being enabled vi a php info call. But there seems to be no performance increase. Is there a way to tell if json is working properly within sugar? Is the 1.2.1 issue for windows only?

    PHP 4.4.0
    Apache 2.0.54

  9. #9
    Jacob's Avatar
    Jacob is offline Senior Member
    Join Date
    Oct 2004
    Posts
    331

    Default Re: Ongoing Performance Work...

    On a positive note, last night I boosted JSON performance by over 90%. You get much better performance if you have Zend Platform installed, but you get a huge boost without it. I just missed the deadline for Beta....This code will be coming in nightly drops or in the first release candidate.

    There is no trivial way to determine if the external JSON is working.
    The easiest way is to open up include/JSON.php.

    Find:
    PHP Code:
            if(function_exists('json_decode') && $sugar_config['use_php_code_json'] == false) {
                
    $value json_encode($var); 
    Add an Echo Statement to let you know if you got in there:
    PHP Code:
            if(function_exists('json_decode') && $sugar_config['use_php_code_json'] == false) {
                
    $value json_encode($var);
    echo 
    "Using external JSON module"
    It may be that the config variable for 'use_php_code_json' is not set to false. I will look into why this variable exists.

    Jacob

  10. #10
    Jacob's Avatar
    Jacob is offline Senior Member
    Join Date
    Oct 2004
    Posts
    331

    Default Re: Ongoing Performance Work...

    One other note. Since JSON 1.2 does not correctly handle multi-byte character encoding, we disable use of the library if it is detected. This may be what is happening to you.

Page 1 of 10 12345 ... LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •