PHPackages                             michaelkeiluweit/warm-up - 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. michaelkeiluweit/warm-up

ActiveOxideshop-component

michaelkeiluweit/warm-up
========================

Warms up the OXID eShop.

1.1.1(1y ago)113PHPPHP &gt;=8.1

Since Aug 13Pushed 1y ago1 watchersCompare

[ Source](https://github.com/michaelkeiluweit/warm-up)[ Packagist](https://packagist.org/packages/michaelkeiluweit/warm-up)[ RSS](/packages/michaelkeiluweit-warm-up/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (5)Versions (4)Used By (0)

About
-----

[](#about)

This command is about to pre-fill the cache by calling the cache-items beforehand.
The mission of this project is to have the directory `tmp` filled automatically as much as possible so that a request from a customer doesn't add anything more, but just benefits from the provided cache files.

### Template Cache

[](#template-cache)

Every `oxstdurl` is called to motivate the template engine to compile the page, which leads to a pre-compiled template cache.

### Pictures

[](#pictures)

All different kinds of pictures are generated from the main picture.

### Container Cache

[](#container-cache)

Note that the container cache is build once any shop command is executed, except oe:clear:cache. So, no extra command for that is needed.

### Module Cache

[](#module-cache)

By calling the `ActiveModulesDataProviderBridge` object, the class extensions, module paths and module controllers will be written to the cache.

### Language Cache

[](#language-cache)

Checks for all active languages and generates the language cache files.

Requirements
------------

[](#requirements)

- OXID eShop 7

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

[](#installation)

```
composer require michaelkeiluweit/warm-up
```

Usage
-----

[](#usage)

```
./vendor/bin/oe-console mk:warm-up
```

See `./vendor/bin/oe-console mk:warm-up --help` for optional switches.

Todos
-----

[](#todos)

- table meta information cache
- try catch iterateAssociative
- doctrine default log? docu says: set to null to increase performance
- database structure cache files generator (done?)
- Multishop compatibility
- Currently only product pictures are generated

Nice to know
============

[](#nice-to-know)

Doubled composer requirements
-----------------------------

[](#doubled-composer-requirements)

The module needs the QueryBuilder, provided by the shop framework, to get the database connection. While running the unit tests in the context of the shop framework it's all fine. But I want to generate the coverage report, which isn't possible via shop framework context, since the file phpunit.xml doesn't have the required parameters. That's why I have to create an own phpunit.xml file within my module and execute the tests in the context of the module. When I run the unit tests in the context of the module, the QueryBuilder isn't locateable. So I must add the doctrine/dbal package to the dev requirements of my module. Also, the QueryBuilderFactoryInterface must be included, which requires the oxideshop-ce package. Currently, the composer.json file contains this require-dev section (which feels like overhead):

```
"require-dev": {
    "phpunit/phpunit": "^11",
    "doctrine/dbal": "^2",
    "oxid-esales/oxideshop-ce": "dev-b-7.1.x",
}
```

As you can see, I've used phpunit 11, which is technically not compatible to the phpunit version the shop is using. That's not so bad, since there is no connection between the shop framework tests and my personal tests. It becomes maybe difficult if someone wants to run all tests at once. And the required PHP version could be a problem.

I have to make sure to have the very same doctrine/dbal package as the shop, since the module builds on top of the framework and uses its functionality. So the module could become incompatible to a new shop version, despite it's all compatible, but the used dependencies could be outdated.

And still, after I've required oxideshop-ce in my project, I can't test the method MichaelKeiluweit\\WarmUp\\Picture\\Factory\\ShopObject::create, since the function startProfile can't be found. When I replace the function oxNew by UtilsObject::getInstance()-&gt;oxNew, then an error appears that the file config.inc.php can't be found.

Performance test: Request resources
-----------------------------------

[](#performance-test-request-resources)

### curl

[](#curl)

```
$saveTime = [];

for ($i = 0; $i < 1000; ++$i) {
    $start = microtime(true);

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, 'https://google.com/');
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_exec($ch);
    curl_close($ch);

    $saveTime[] = microtime(true) - $start;
}

$reduce = array_reduce($saveTime, function ($carry, $item) {
    return $carry + $item;
});

var_dump($reduce / 1000);
```

```
float(0.0665782573223114)
```

### file\_get\_contents

[](#file_get_contents)

```
$saveTime = [];

for ($i = 0; $i < 1000; ++$i) {

    $start = microtime(true);

    file_get_contents('https://google.com/');

    $saveTime[] = microtime(true) - $start;
}

$reduce = array_reduce($saveTime, function ($carry, $item) {
    return $carry + $item;
});

var_dump($reduce / 1000);
```

```
float(0.37306804990768433)
```

Performance test: Big data query
--------------------------------

[](#performance-test-big-data-query)

### Specs

[](#specs)

-
- mysql Ver 14.14 Distrib 5.7.42, for Linux (x86\_64)
- PHP 8.2.21
- OXID eShop Enterprise Edition 7.1.1
- doctrine/dbal: 2.13.9
- 5.8 million products
- 13.1 million seo entries

Between each test the database container was restarted to clear the cached information. To monitor that, the docker desktop extension [Resource usage](https://hub.docker.com/extensions/docker/resource-usage-extension) was used.

Every test code (except test #1) was embedded in an oxideshop-component code and executed by calling `./vendor/bin/oe-console m:c:w`:

```
