diff --git a/core/assets/scaffold/files/default.services.yml b/core/assets/scaffold/files/default.services.yml index 1243d06008988bc493548e8f4396ba4bf513376f..3570cfa934e61ddfb5d58c802cb4620514e6bfcf 100644 --- a/core/assets/scaffold/files/default.services.yml +++ b/core/assets/scaffold/files/default.services.yml @@ -238,6 +238,11 @@ parameters: # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Credentials supportsCredentials: false + # The maximum number of entities stored in memory. Lowering this number can + # reduce the amount of memory used in long-running processes like migrations, + # however will also increase requests to the database or entity cache backend. + entity.memory_cache.slots: 1000 + queue.config: # The maximum number of seconds to wait if a queue is temporarily suspended. # This is not applicable when a queue is suspended but does not specify diff --git a/core/core.services.yml b/core/core.services.yml index bb73e29d505bc93dec5e23853174d9127cdd04e0..1ee586a6d60793a12c48a651acee696af77e3a4c 100644 --- a/core/core.services.yml +++ b/core/core.services.yml @@ -8,6 +8,7 @@ parameters: # function properly before that runs. cache_default_bin_backends: [] memory_cache_default_bin_backends: [] + entity.memory_cache.slots: 1000 security.enable_super_user: true core.moved_classes: 'Drupal\Core\StringTranslation\TranslationWrapper': @@ -705,8 +706,8 @@ services: arguments: ['@theme_handler', '@config.factory', '@config.installer', '@module_handler', '@config.manager', '@asset.css.collection_optimizer', '@router.builder', '@logger.channel.default', '@state', '@extension.list.module', '@theme.registry', '@extension.list.theme'] Drupal\Core\Extension\ThemeInstallerInterface: '@theme_installer' entity.memory_cache: - class: Drupal\Core\Cache\MemoryCache\MemoryCache - arguments: ['@datetime.time'] + class: Drupal\Core\Cache\MemoryCache\LruMemoryCache + arguments: ['@datetime.time', '%entity.memory_cache.slots%'] Drupal\Core\Cache\MemoryCache\MemoryCacheInterface: '@entity.memory_cache' entity_type.manager: class: Drupal\Core\Entity\EntityTypeManager diff --git a/core/modules/migrate/src/MigrateExecutable.php b/core/modules/migrate/src/MigrateExecutable.php index e00e8af74760364f2e71bcd30a57202c19d8118c..a087ae6875e4902abf451db4313ca5f5e48aa276 100644 --- a/core/modules/migrate/src/MigrateExecutable.php +++ b/core/modules/migrate/src/MigrateExecutable.php @@ -612,9 +612,6 @@ protected function attemptMemoryReclaim() { // plenty of memory to continue. drupal_static_reset(); - // Entity storage can blow up with caches, so clear it out. - \Drupal::service('entity.memory_cache')->deleteAll(); - // @todo Explore resetting the container. // Run garbage collector to further reduce memory. diff --git a/sites/default/default.services.yml b/sites/default/default.services.yml index 1243d06008988bc493548e8f4396ba4bf513376f..3570cfa934e61ddfb5d58c802cb4620514e6bfcf 100644 --- a/sites/default/default.services.yml +++ b/sites/default/default.services.yml @@ -238,6 +238,11 @@ parameters: # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Credentials supportsCredentials: false + # The maximum number of entities stored in memory. Lowering this number can + # reduce the amount of memory used in long-running processes like migrations, + # however will also increase requests to the database or entity cache backend. + entity.memory_cache.slots: 1000 + queue.config: # The maximum number of seconds to wait if a queue is temporarily suspended. # This is not applicable when a queue is suspended but does not specify