Knowledgebase

High iowait and/or load average when APC enabled in PHP Selector

When you experience high iowait and/or load average specifically when APC (Alternative PHP Cache) is enabled in PHP Selector, it could indicate a few potential issues. Here are steps you can take to troubleshoot and potentially resolve the problem:

  1. Verify APC Configuration:

    • Double-check the APC configuration to ensure it's correctly set up. Ensure that the cache size and TTL values are appropriate for your application.
  2. Check Disk I/O:

    • Use tools like iotop or sar to monitor disk I/O. High iowait could indicate that the server is struggling to read/write data to the disk quickly enough. This might be due to APC using the disk for caching.
  3. Adjust APC Settings:

    • If the cache size is set too high, it could potentially lead to excessive disk I/O. Consider reducing the cache size to see if it alleviates the issue.
  4. Monitor Disk Usage:

    • Check the overall disk usage. If the disk is nearing capacity, it can lead to slower read/write operations, causing high iowait.
  5. Consider Switching to OPCache:

    • OPCache is the successor to APC and has been built into PHP since version 5.5. It's generally more efficient and reliable. Consider switching to OPCache if it's compatible with your setup.
  6. Examine PHP Code:

    • Poorly optimized PHP code can lead to excessive disk I/O. Review your code for any inefficient database queries or file operations.
  7. Optimize Database Queries:

    • If your application interacts with a database, ensure that your queries are optimized, and consider adding indexes where necessary.
  8. Consider a Different Cache Method:

    • If APC continues to cause issues, consider trying an alternative caching method like Redis or Memcached.
  9. Review Server Resources:

    • Ensure that your server has sufficient resources (CPU, RAM, and disk speed) to handle the workload and the caching mechanism you're using.
  10. Upgrade or Reinstall APC:

    • If you're using an older version of APC, consider upgrading to the latest version or reinstalling it with updated configuration settings.
  11. Check for Conflicts:

    • Ensure that there are no conflicts between APC and other server components or applications.
  12. Monitor Server Logs:

    • Check server logs for any error messages or warnings related to APC. This might provide insights into what's causing the high iowait.
  13. Consider a Profiler:

    • Use a PHP profiler to identify specific functions or code segments that are causing excessive disk I/O.
  14. Load Testing:

    • Conduct load testing to simulate high-traffic scenarios and monitor how the server performs with APC enabled.

Always make changes one at a time and monitor the impact of each change to isolate the most effective solutions. Additionally, have backups and perform changes in a controlled environment to avoid unexpected issues.

 
  • 0 Users Found This Useful
Was this answer helpful?