# genaker/module-opcache

> PHP OPCache and Magento Performance monitoring and analytics

`composer require genaker/module-opcache`

Canonical URL: https://packagento.com/genaker/module-opcache

## At a glance

- **Vendor**: genaker (https://packagento.com/genaker.md)
- **Latest version**: 1.0.21 — released 2025-08-15
- **Pricing**: Free
- **Package type**: Magento 2 module
- **Status**: active, accepting new buyers

## Installation

Packagento is licence-gated, so even free packages need a licence on a project before Composer can resolve them.

1. **Sign in or create an account** at https://packagento.com/customer/account/.

2. **Add the package to your account.** Open https://packagento.com/genaker/module-opcache and complete the free checkout. A licence is minted automatically.

3. **Create or pick a project, then activate the licence on it.**
   - Projects represent the Magento installs you deploy to. Manage them at https://packagento.com/projects/.
   - Activate the new licence on the project you'll deploy this package to. Activation is what generates the Composer credentials scoped to that project.

4. **Add the project credentials to your Magento codebase.**

   Grab the project's public + private key from https://packagento.com/projects/ (open the project, then its Credentials tab), and add them to `auth.json`:

   ```json
   {
     "http-basic": {
       "packagento.com": {
         "username": "ppk_live_...",
         "password": "psk_live_..."
       }
     }
   }
   ```

   Add the Packagento Composer repository to `composer.json`:

   ```json
   {
     "repositories": [
       { "type": "composer", "url": "https://packagento.com" }
     ]
   }
   ```

5. **Install and apply.**

   ```bash
   composer require genaker/module-opcache:*
   bin/magento setup:upgrade
   bin/magento setup:di:compile
   bin/magento cache:flush
   ```

## What it does

PHP OPCache and Magento Performance monitoring and analytics

## README

Advanced Magento 2 Performance Monitoring & OPcache Control GUI with comprehensive benchmarking tools.

![Magento 2 Opcache GUI](https://github.com/Genaker/Magento2OPcacheGUI/raw/main/Magento-Opcache-Gui.jpg)

## Magento Server Performance Toolkit New GUI

![opcacheGui](https://github.com/user-attachments/assets/dbe40aea-cf95-43ed-be34-a3a6b451bf08)

### Key Features

#### **Performance Benchmarking Suite**
- **CPU Performance Testing** - Multi-iteration BogoMIPS measurement
- **Memory Allocation Analysis** - Memory usage patterns and optimization detection
- **File Operations Testing** - I/O performance measurement
- **Database Latency Testing** - MySQL connection and query performance
- **Redis Latency Testing** - Cache backend performance analysis
- **HTTP Performance Testing** - Cached vs Uncached page load comparison
- **Random URL Testing** - Real-world product and category page performance

#### **Advanced HTTP Performance Analysis**
- **Cached Performance Testing** - Measures Full Page Cache (FPC) effectiveness
- **Uncached Performance Testing** - Real-world logged-in user experience
- **Random Product URL Testing** - Dynamic product page performance
- **Random Category URL Testing** - Category browsing performance
- **Cache Performance Comparison** - Side-by-side cached vs uncached analysis
- **Cache Limitations Warning** - Educational information about FPC behavior

#### **Enhanced User Interface**
- **Loading Spinner with Dynamic Steps** - Rotating performance test indicators
- **Console-themed Design** - Professional terminal-style interface
- **Real-time Progress Tracking** - Step-by-step loading feedback
- **Responsive Layout** - Optimized for admin panel integration
- **Professional Error Handling** - Graceful fallbacks and debugging

#### **Configuration & Diagnostics**
- **OPcache Status Analysis** - Comprehensive OPcache configuration review
- **PHP Configuration Analysis** - PHP settings optimization recommendations
- **Security Analysis** - Security configuration assessment
- **Server Configuration Review** - System-level performance insights
- **Configurable Test Parameters** - Customizable iterations and timeouts via DI

#### **Technical Architecture**
- **Dependency Injection** - Clean, testable architecture
- **Performance Toolkit Class** - Modular performance testing functions
- **Block-based Architecture** - Magento 2 best practices
- **Random URL Generation** - Store-aware product and category selection
- **Error Handling & Logging** - Comprehensive error management
- **Cache-busting Technology** - Accurate uncached performance measurement

### Where to Find in Admin Menu

**System > Tools > Performance and Opcache GUI**

### Installation 

#### Method 1: Manual Installation
Copy to `app/code`, run setup, and compile as usual.

This Extension doesn't need static content generation - it uses CDN version of React JS. Install with flag `--keep-generated`.

#### Method 2: Composer Installation
```bash
composer require genaker/module-opcache
```

#### Post-Installation
```bash
php bin/magento module:enable Genaker_Opcache
php bin/magento setup:upgrade
php bin/magento cache:flush
```

### Magento 2 OPcache Optimal Settings

The biggest Magento 2 performance issue is incorrect (default) PHP OPcache settings.

#### Production Web Server Settings
```ini
opcache.enable = 1
opcache.enable_cli = 0
opcache.memory_consumption = 556
opcache.max_accelerated_files = 1000000
opcache.validate_timestamps = 0
opcache.interned_strings_buffer = 64
opcache.max_wasted_percentage = 5
opcache.save_comments = 1
opcache.fast_shutdown = 1
```

#### CLI OPcache Settings
Separate CLI config file (e.g., `/etc/php/8.1/cli/conf.d/10-opcache.ini`):
```ini
zend_extension=opcache.so
opcache.memory_consumption=1000M
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=10000000
opcache.validate_timestamps=1
opcache.enable_cli=1
opcache.file_cache=/tmp/
opcache.file_cache_only=0
opcache.file_cache_consistency_checks=1
```

### Performance Benchmarking Features

#### **PHP BogoMIPS Performance Measurement**
Advanced PHP performance testing that measures actual Magento code execution speed.

Magento 2 is CPU-intensive due to framework design. Use the fastest CPU for optimal page rendering. If a 2GHz processor takes 3 seconds, a 3GHz processor will complete the same request in ~2 seconds.

![Magento 2 PHP performance](https://github.com/Genaker/Magento2OPcacheGUI/raw/main/PHP-performance.jpg)

##### Benchmark Reference Scores (lower is better):
- **AWS C5.large**: 0.032 (PHP 7.3.23)
- **AWS R5.xlarge**: 0.039 (PHP 7.2.34)  
- **AWS C8.xlarge**: 0.029 (PHP 8.1 web), 0.066 (CLI - OPcache limitation)

#### **HTTP Performance Testing**
- **Cached Testing**: Measures Full Page Cache effectiveness
- **Uncached Testing**: Real logged-in user experience with cache-busting
- **Random URL Testing**: Dynamic product/category page performance
- **Performance Comparison**: Side-by-side analysis with improvement percentages

#### **Cache Limitations Analysis**
Educational warnings about Magento FPC behavior:
- FPC primarily benefits guest visitors only
- Logged-in customers typically bypass FPC
- Cache can be invalidated by content updates
- Search requests and category filters are rarely cached
- Focus on uncached performance for sustainable improvements

### **Advanced Configuration**

#### Dependency Injection Configuration
Performance parameters can be customized via `etc/di.xml`:

```xml
<argument name="config" xsi:type="array">
    <item name="performance_iterations" xsi:type="number">3</item>
    <item name="http_performance_iterations" xsi:type="number">3</item>
    <item name="db_performance_iterations" xsi:type="number">3</item>
    <item name="collection_page_size" xsi:type="number">100</item>
</argument>
```

_(README truncated for .md surface. Full README on https://packagento.com/genaker/module-opcache.)_

## Recent Versions

| Version | Released |
|---|---|
| 1.0.21 | 2025-08-15 |
| 1.0.20 | 2025-08-14 |
| 1.0.19 | 2025-08-14 |
| 1.0.18 | 2025-08-13 |
| 1.0.17 | 2025-08-12 |
| 1.0.16 | 2025-08-12 |
| 1.0.14 | 2025-08-12 |
| 1.0.13 | 2025-08-12 |
| 1.0.12 | 2025-08-11 |
| 1.0.11 | 2025-08-11 |

Showing 10 of 21 versions. Full release history on https://packagento.com/genaker/module-opcache.

## Dependencies

### Require

| Package | Constraint |
|---|---|
| amnuts/opcache-gui | ^3.0 |

## Quality

Latest release (1.0.21) fails the Packagento QA pipeline. Verdicts below are per-cell (Magento line × PHP version) for the matrixed tools, and run-once for the static / security tiers.


### Compatibility

Each Magento line is installed on its supported PHP versions, then the module is built (DI compile + static-content deploy). Cells show passed / failed / untested; staircase gaps render as `–`.

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | Pass | Pass | – | – |
| 2.4.8 | – | Pass | Pass | – |
| 2.4.9 | – | – | Pass | Pass |


### Code Quality

Advisory checks against the module's source. Never affect the Compatibility verdict — a phpcs finding can't make a module incompatible.

#### Static Analysis

Coding standards (phpcs), mess detection (phpmd), copy-pasted code (cpd), PHP cross-version compatibility, composer.json validity. Each runs once for the whole module.

| Tool | Status | Findings | Summary |
|---|---|---|---|
| PHPCS | Fail | 340 | 20 errors, 320 warnings (ruleset: Magento2) — 61 auto-fixable with phpcbf |
| PHPMD | Warning | 59 | 59 rule violations (CyclomaticComplexity:12, UnusedLocalVariable:12, NPathComplexity:11, ExcessiveMethodLength:8, MissingImport:7) |
| Cpd | Warning | 1 | 1 duplicated chunk spanning 42 total lines (min-lines=5, min-tokens=70) |
| Composer validate | Pass | 0 |  |

#### PHPStan

Type-checks the module against a real Magento install. Re-runs per Magento + PHP version because resolvable symbols differ between releases.

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | 43 | 43 | – | – |
| 2.4.8 | – | 41 | 41 | – |
| 2.4.9 | – | – | 41 | 41 |


### Tests

Unit and integration suites run per Magento + PHP cell. Test failures speak to the module's behaviour, not its compatibility with a line, so they're reported here separately.

#### Unit Tests

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | N/A | N/A | – | – |
| 2.4.8 | – | N/A | N/A | – |
| 2.4.9 | – | – | N/A | N/A |

#### Integration Tests

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | N/A | N/A | – | – |
| 2.4.8 | – | N/A | N/A | – |
| 2.4.9 | – | – | N/A | N/A |


### Security

Dependency-advisory audit (composer audit) plus a source malware scan. A malware detection fails the version outright.

| Tool | Status | Findings | Summary |
|---|---|---|---|
| Composer audit | Pass | 0 |  |
| Malware scan | Pass | 0 |  |

## Licence and pricing

Free. A licence is still minted on checkout and bound to your project for Composer access — no payment step.

Refundable within 14 days of first purchase via https://packagento.com/account/refunds/.

## Install via Claude Code or any MCP client

The Packagento MCP server can run the licence + project + Composer steps above in one tool call:

```
purchase_and_install_packages(
  composer_names=["genaker/module-opcache"],
  project_id="proj_xxx"
)
```

This handles cart, checkout, licence minting, project activation, and writes auth.json credentials. Connect a client with `claude mcp add packagento https://mcp.packagento.com`. Full setup at https://packagento.com/docs/mcp-setup.

## Vendor

genaker is a Magento 2 vendor on Packagento. See https://packagento.com/genaker.md for their full catalogue.

