PHPackages                             veysiyildiz/module-graphql-performance - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Caching](/categories/caching)
4. /
5. veysiyildiz/module-graphql-performance

ActiveMagento2-module[Caching](/categories/caching)

veysiyildiz/module-graphql-performance
======================================

A comprehensive GraphQL performance optimization module for Magento 2

1.1.6(9mo ago)1793MITPHPPHP ~7.4.0||~8.1.0CI failing

Since Aug 10Pushed 9mo ago3 watchersCompare

[ Source](https://github.com/veysiyildiz/magento2-graphql-performance)[ Packagist](https://packagist.org/packages/veysiyildiz/module-graphql-performance)[ Docs](https://github.com/veysiyildiz/magento2-graphql-performance)[ GitHub Sponsors](https://github.com/sponsors/veysiyildiz)[ RSS](/packages/veysiyildiz-module-graphql-performance/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (6)Dependencies (19)Versions (6)Used By (0)

Sterk GraphQL Performance Module for Magento 2
==============================================

[](#sterk-graphql-performance-module-for-magento-2)

Overview
--------

[](#overview)

The Sterk GraphQL Performance module is a comprehensive solution for optimizing GraphQL performance in Magento 2. It addresses common performance bottlenecks, implements efficient data loading patterns, and provides robust caching strategies.

Features
--------

[](#features)

### 1. Data Loading Optimization

[](#1-data-loading-optimization)

- DataLoader pattern implementation for batch loading
- Prevention of N+1 query problems
- Efficient data retrieval for:
    - Products
    - Categories
    - Customers
    - CMS Pages/Blocks
    - Orders and Invoices
    - Brand Categories
    - Credit Memos

### 2. Caching Infrastructure

[](#2-caching-infrastructure)

- Multi-level caching strategy
- Intelligent cache tag management
- Automatic cache warming
- Query-level caching
- Field-level result caching
- Cache invalidation optimization

### 3. Performance Monitoring

[](#3-performance-monitoring)

- Query execution time tracking
- Performance metrics collection
- GraphQL query complexity analysis
- Resource usage monitoring
- Performance reporting

### 4. Database Optimization

[](#4-database-optimization)

- Connection pooling
- Transaction management
- Batch query optimization
- Efficient resource utilization

Installation
------------

[](#installation)

1. Install via Composer:

```
composer require veysiyildiz/module-graphql-performance
```

2. Enable the module:

```
bin/magento module:enable Sterk_GraphQlPerformance
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento cache:clean
```

Configuration
-------------

[](#configuration)

### Admin Configuration

[](#admin-configuration)

Navigate to Stores &gt; Configuration &gt; Sterk &gt; GraphQL Performance to configure:

1. Cache Settings

    - Cache lifetime for different entities
    - Cache warming patterns
    - Cache invalidation rules
2. Performance Limits

    - Query complexity limits
    - Query depth restrictions
    - Batch size configurations
3. Monitoring Settings

    - Performance logging
    - Metric collection
    - Report generation

### Cache Warming Configuration

[](#cache-warming-configuration)

Configure cache warming in `etc/config.xml`:

```

                1
                3600

```

Usage
-----

[](#usage)

### Basic Implementation

[](#basic-implementation)

```
use Sterk\GraphQlPerformance\Model\DataLoader\ProductDataLoader;

class ProductResolver implements ResolverInterface
{
    public function __construct(
        private readonly ProductDataLoader $dataLoader
    ) {}

    public function resolve(
        Field $field,
        $context,
        ResolveInfo $info,
        array $value = null,
        array $args = null
    ) {
        return $this->dataLoader->load($args['id']);
    }
}
```

### Advanced Features

[](#advanced-features)

#### Custom DataLoader

[](#custom-dataloader)

```
use Sterk\GraphQlPerformance\Model\DataLoader\BatchDataLoader;

class CustomDataLoader extends BatchDataLoader
{
    protected function loadFromDatabase(array $ids): array
    {
        // Implement batch loading logic
    }

    protected function generateCacheKey(string $id): string
    {
        return "custom_entity_{$id}";
    }
}
```

#### Cache Tag Management

[](#cache-tag-management)

```
use Sterk\GraphQlPerformance\Model\Cache\TagManager;

class CustomResolver
{
    public function __construct(
        private readonly TagManager $tagManager
    ) {}

    public function resolve($field)
    {
        $tags = $this->tagManager->getEntityTags('custom_entity', $id);
        // Use tags for cache operations
    }
}
```

Performance Monitoring
----------------------

[](#performance-monitoring)

### Metrics Collection

[](#metrics-collection)

The module automatically collects:

- Query execution times
- Cache hit rates
- Database query counts
- Memory usage
- Query complexity scores

### Reporting

[](#reporting)

Access performance reports via:

1. GraphQL API endpoint
2. Admin dashboard
3. Command line interface

Best Practices
--------------

[](#best-practices)

### 1. Query Optimization

[](#1-query-optimization)

- Use field selection wisely
- Implement pagination
- Leverage query batching
- Monitor query complexity

### 2. Caching Strategy

[](#2-caching-strategy)

- Configure appropriate cache lifetimes
- Use specific cache tags
- Implement proper invalidation
- Enable cache warming

### 3. Resource Management

[](#3-resource-management)

- Configure connection pooling
- Monitor memory usage
- Implement query timeouts
- Use batch processing

Troubleshooting
---------------

[](#troubleshooting)

### Common Issues

[](#common-issues)

1. Cache Invalidation

```
Issue: Stale data after updates
Solution: Check cache tags and invalidation events

```

2. Performance Degradation

```
Issue: Slow query response
Solution: Monitor query complexity and database connections

```

3. Memory Usage

```
Issue: High memory consumption
Solution: Adjust batch sizes and connection pool settings

```

Contributing
------------

[](#contributing)

We welcome contributions! Please see CONTRIBUTING.md for guidelines.

License
-------

[](#license)

MIT License - see LICENSE.md for details

Support
-------

[](#support)

For support, please:

1. Check documentation
2. Search existing issues
3. Create a new issue
4. Contact

Changelog
---------

[](#changelog)

See CHANGELOG.md for version history

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance58

Moderate activity, may be stable

Popularity14

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1 days

Total

4

Last Release

278d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/00f47c95dd0e593bf8c3944f5ce42ad573c9f10df6df390a821b4be89a2897fe?d=identicon)[veysiyildiz](/maintainers/veysiyildiz)

---

Top Contributors

[![veysiyildiz](https://avatars.githubusercontent.com/u/2284134?v=4)](https://github.com/veysiyildiz "veysiyildiz (142 commits)")

---

Tags

graphqlperformancecachingoptimizationmagento2magento2 module

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Psalm

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/veysiyildiz-module-graphql-performance/health.svg)

```
[![Health](https://phpackages.com/badges/veysiyildiz-module-graphql-performance/health.svg)](https://phpackages.com/packages/veysiyildiz-module-graphql-performance)
```

###  Alternatives

[smile/elasticsuite

Magento 2 merchandising and search engine built on ElasticSearch

8044.5M33](/packages/smile-elasticsuite)[putyourlightson/craft-blitz

Intelligent static page caching for creating lightning-fast sites.

153471.5k29](/packages/putyourlightson-craft-blitz)[alekseykorzun/memcached-wrapper-php

Optimized PHP 5 wrapper for Memcached extension that supports dog-piling, igbinary and local storage

2984.6k1](/packages/alekseykorzun-memcached-wrapper-php)[silverstripe/staticpublishqueue

Static publishing queue to create static versions of pages for enhanced performance and security

45135.4k4](/packages/silverstripe-staticpublishqueue)[maartenstaa/laravel-41-route-caching

This package allows you to cache your routes definitions, thereby speeding up each request.

25371.9k](/packages/maartenstaa-laravel-41-route-caching)[tractorcow/silverstripe-dynamiccache

FORK OF Silverstripe module for simple on the fly caching of dynamic content

3916.0k2](/packages/tractorcow-silverstripe-dynamiccache)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
