Sweet Spot
Reader JD commented on my previous post, Developer Secrets | Part 1 reminding me of a hidden feature of Sugar, the Sweet Spot Search bar which allows for access to both records and administrative actions. If you have not given it a try recently you should.
To open Sweet Spot, use the appropriate shortcut key sequence for your operating system:
macOS: shift+cmd+space
Windows: shift+ctrl+space
Linux: shift+ctrl+space
Schedulers (i.e., Job Queue)
The table job_queue which is used by the Schedulers module is hidden from the user experience and makes it difficult to troubleshoot when there are issues. Our good friend Kenneth Brill wrote a wonderful blog post about accessing the job_queue. However, his Module Loadable Package (MLP) is no longer compatible with Sugar Cloud. An updated version that can be installed on Sugar Cloud can be obtained from https://github.com/bickart/job_queue.
Queries with Parameters in PHPStorm
Did you know you can use the Query Console in PHPStorm to input parameters? When Sugar generates a query the parameters are listed in the query with question marks. You can leverage PHPStorm to enter the parameters. For more details, https://www.jetbrains.com/help/idea/run-a-query.html#running_parameterized_statements
Zend OpCache
The Zend OpCode cache comes bundled with PHP. When enabled and properly configured, this extension provides impressive Sugar performance improvements (and all PHP apps in general). It’s not uncommon to see an instant 300-500% speed up once it’s turned on. Provided you ensure enough memory, enabling the opcache is seamless. Therefore turning it on in your production environment is strongly recommended.
However, be advised that depending on your Sugar use case, enabling a misconfigured opcache might have unexpected results. If you use Studio to manage and customize your instance make sure that opcache revalidation is properly configured. The opcode cache should be emptied based on file modified timestamps rather than the usual revalidate frequency. Example config for a Studio-enabled deployment can be as follows:
# Disable time based cache revalidation
opcache.revalidate_freq = 0
# Enable modified timestamp based revalidation
opcache.validate_timestamps = 1
# Memory allowance, best to keep it high
opcache.memory_consumption = 512
# Max number of files that will be cached
opcache.max_accelerated_files = 100000
# Especially useful with PHP-FPM, shared variable values pool
opcache.interned_strings_buffer = 32
# Quick object shutdown
opcache.fast_shutdown = 1
Hi Jeff,
Thanks a lot for your article, very nice from you. I configured the way you explained for opcache, how can we monitore how it is working, and if it is working well ? What can we use to make some finetunings ?
And second thing, do you have any tricks to configure properly php-fpm ?
For our customer onsite we are in a clustered installation :
2 nodes for apache with a shared folder between them, php-fpm configured for both, ES installed only on LB mode (node master and data false)
3 servers for ES on a clustered installation
Thanks for your work and your feedback !
Best regards,
Enes