nuxt / nuxt/image

Extremely high processor load when processing images using `ipx`

Open
#1,954 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
1.5k
Forks
331
Avg merge
19h 52m
Merged PRs (30d)
9

Description

Environment
  • Operating System: Linux
  • Node Version: v22.19.0
  • Nuxt Version: 3.17.7
  • Nitro Version: 2.12.5
  • Package Manager: npm
Version

1.11.0

Description

When processing images using ipx on the server, the processor is subjected to an extremely high load.

Additional context

I attempted to utilize @nuxt/image to optimize image loading. I retained ipx as the provider. When I deploy my application to the server, the processor becomes heavily loaded when loading pages and sending requests for images. If I specify the format [“avif”, ‘webp’] in nuxt.config.ts, the wait time from the server can be around 10-15 seconds. If I leave only [“webp”], the time is reduced to 2-4 seconds (which is still a lot).

nuxt.config.ts:

  image: {
    domains: ['cdn.name.io'],
    format: ['avif', 'webp'],
    provider: 'ipx',
    ipx: {
      maxAge: 60 * 60 * 24 * 365,
    },
    screens: {
      xxs: 360,
      s: 391,
      xs: 528,
      sm: 768,
      md: 920,
      l: 1160,
      lm: 1280,
      lg: 1440,
      xl: 1617,
      xxl: 1833,
      xxxl: 2264,
    },
  }
Image Image Image

If i switch to a custom provider (just take the image from the original link), the problem disappears.

providers/selfhost.ts:

import { joinURL } from 'ufo';
import type { ProviderGetImage } from '@nuxt/image';
import { createOperationsGenerator } from '#image';

const operationsGenerator = createOperationsGenerator();

export const getImage: ProviderGetImage = (
  src,
  { modifiers = {} } = {},
) => {
  const baseUrl = '';
  const operations = operationsGenerator(modifiers);
  return {
    url: joinURL(baseUrl, src + (operations ? '?' + operations : '')),
  };
};

In a locally running application, when requesting a page and processing images, the processor load increases from 7% to 15-20% (MacBook M3 Pro), but this is enough for the images to load instantly.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with nuxt.config.ts and providers/selfhost.ts, then reproduce image requests through the ipx provider using the reported AVIF and WebP configurations. Compare the server load and response times with the custom provider behavior. Done means identifying and addressing the excessive processor usage and long image response times under these scenarios.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
backend, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.