Bellog

๐Ÿค”

readFile vs readFileSync (feat: Artillery)

blog

2025-04-04

MDXIMage ๊ตฌํ˜„

MDX ํŒŒ์ผ์—์„œ ์ด๋ฏธ์ง€๋ฅผ ๋ฐ›์•„์˜ค๋Š” ๋ถ€๋ถ„์€ ๋‹ค์Œ๊ณผ ๊ฐ™์ด ๊ตฌํ˜„๋˜์–ด ์žˆ์—ˆ๋‹ค.

SyncImage
1import fs from "fs";
2import sizeOf from "image-size";
3import Image from "next/image";
4import path from "path";
5import { useMemo } from "react";
6
7interface MDXImageProps {
8 src: string;
9 alt: string;
10}
11
12interface ImageDimensions {
13 width: number;
14 height: number;
15}
16
17export default function SyncImage({ src, alt }: MDXImageProps) {
18 const dimensions: ImageDimensions = useMemo(() => {
19 // ํด๋ผ์ด์–ธํŠธ ์ธก์—์„œ๋Š” ์‹คํ–‰ํ•˜์ง€ ์•Š์Œ
20 if (typeof window !== "undefined") {
21 return { width: 700, height: 475 }; // ๊ธฐ๋ณธ๊ฐ’ ์„ค์ •
22 }
23
24 try {
25 // public ํด๋” ๋‚ด์˜ ์ด๋ฏธ์ง€ ๊ฒฝ๋กœ ๊ตฌ์„ฑ
26 const imagePath = path.join(process.cwd(), "public", src);
27
28 // ํŒŒ์ผ์ด ์กด์žฌํ•˜๋Š”์ง€ ํ™•์ธ
29 if (!fs.existsSync(imagePath)) {
30 console.warn(`Image not found: ${imagePath}`);
31 return { width: 700, height: 475 }; // ์ด๋ฏธ์ง€๋ฅผ ์ฐพ์ง€ ๋ชปํ•œ ๊ฒฝ์šฐ ๊ธฐ๋ณธ๊ฐ’ ๋ฐ˜ํ™˜
32 }
33
34 // ํŒŒ์ผ์„ ๋ฐ”์ด๋„ˆ๋ฆฌ๋กœ ์ฝ๊ธฐ
35 const buffer = fs.readFileSync(imagePath);
36
37 // image-size๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์ด๋ฏธ์ง€ ํฌ๊ธฐ ๊ณ„์‚ฐ
38 const dimensions = sizeOf(buffer);
39
40 return {
41 width: dimensions.width || 700,
42 height: dimensions.height || 475,
43 };
44 } catch (error) {
45 console.error("Error getting image dimensions:", error);
46 return { width: 700, height: 475 }; // ์˜ค๋ฅ˜ ๋ฐœ์ƒ ์‹œ ๊ธฐ๋ณธ๊ฐ’ ๋ฐ˜ํ™˜
47 }
48 }, [src]);
49
50 return (
51 <Image
52 src={src}
53 alt={alt || ""}
54 width={dimensions.width}
55 height={dimensions.height}
56 style={{
57 maxWidth: "100%",
58 height: "auto",
59 }}
60 className="rounded-[10px]"
61 />
62 );
63}

๊ฐ€์žฅ ํ•ต์‹ฌ์ ์ธ ๋ถ€๋ถ„์€ ๋‹ค์Œ๊ณผ ๊ฐ™๋‹ค.

1// ํŒŒ์ผ์„ ๋ฐ”์ด๋„ˆ๋ฆฌ๋กœ ์ฝ๊ธฐ
2const buffer = fs.readFileSync(imagePath);
3
4// image-size๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์ด๋ฏธ์ง€ ํฌ๊ธฐ ๊ณ„์‚ฐ
5const dimensions = sizeOf(buffer);
6
7return {
8 width: dimensions.width || 700,
9 height: dimensions.height || 475,
10};

readFileSync๋ฅผ ํ†ตํ•ด ์ด๋ฏธ์ง€๋ฅผ ๋ถˆ๋Ÿฌ์˜ค๊ณ , sizeOf๋ฅผ ์ด์šฉํ•ด ๋ถˆ๋Ÿฌ์˜จ ์ด๋ฏธ์ง€์˜ ์‚ฌ์ด์ฆˆ๋ฅผ ๊ตฌํ•ด์„œ return ํ•œ๋‹ค.

์ด๋ ‡๊ฒŒ๋งŒ ๋ณด๋ฉด, ์•„๋ฌด๋Ÿฐ ์ƒ๊ฐ์ด ๋“ค์ง€ ์•Š๋Š”๋‹ค.

๊ดœ์ฐฎ์€ ์ฝ”๋“œ ์•„๋‹Œ๊ฐ€?

๊ทธ๋Ÿฌ๋‚˜ ๊ณต์‹ ๋ฌธ์„œ์—์„œ๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์ด ๋งํ•˜๊ณ  ์žˆ๋‹ค.

1Reading from a file Syncronously (not recommended)
2v1.x of this library had a sync API, that internally used sync file reads.
3This isn't recommended because this blocks the node.js main thread, which reduces the performance, and prevents this library from being used concurrently.
4However if you still need to use this package syncronously, you can read the file syncronously into a buffer, and then pass the buffer to this library.

๋™๊ธฐ์ ์œผ๋กœ ํŒŒ์ผ์„ ์ฝ์–ด์˜ค๋ฉด node.js์˜ ๋ฉ”์ธ ์“ฐ๋ ˆ๋“œ๋ฅผ ๋ฉˆ์ถ”๊ฒŒ ํ•˜๊ณ , ์ด๋Š” ๊ณง ์„ฑ๋Šฅ ์ €ํ•˜๋กœ ์ด์–ด์ง„๋‹ค๊ณ  ํ•œ๋‹ค.

๋‹ค์Œ ๋‹ต๋ณ€์—์„œ๋Š” โ€˜์ ˆ๋Œ€โ€™ ์“ฐ์ง€ ๋ง๋ผ๊ณ  ํ•˜๊ธฐ๋„ ํ•œ๋‹ค.

๊ทธ๋Ÿฌ๋ฉด ์–ด๋–ป๊ฒŒ ์ž‘์„ฑํ•˜๋Š”๊ฒŒ ์ข‹์„๊นŒ?

ํ•ด๋‹น ์ฝ”๋“œ๊ฐ€ ๋ฐ˜๋“œ์‹œ ์ •๋‹ต์€ ์•„๋‹ˆ๋‹ค.

AsyncImage.tsx
1import Image from "next/image";
2import { getPlaiceholder } from "plaiceholder";
3import fs from "fs/promises";
4import path from "path";
5
6interface MDXImageProps {
7 src: string;
8 alt: string;
9}
10
11interface ImageMetadata {
12 width: number;
13 height: number;
14 blurDataURL?: string;
15}
16
17// This function can be used with getStaticProps or in a Server Component
18export async function getImageMetadata(src: string): Promise<ImageMetadata> {
19 try {
20 const imagePath = path.join(process.cwd(), "public", src);
21 const buffer = await fs.readFile(imagePath);
22
23 // Get image dimensions and optional blur placeholder
24 const { metadata, base64 } = await getPlaiceholder(buffer);
25
26 return {
27 width: metadata.width,
28 height: metadata.height,
29 blurDataURL: base64,
30 };
31 } catch (error) {
32 console.error(`Error processing image ${src}:`, error);
33 return { width: 700, height: 475 };
34 }
35}
36
37// For use in Server Components (App Router)
38export default async function AsyncImage({ src, alt }: MDXImageProps) {
39 const imageMetadata = await getImageMetadata(src);
40
41 return (
42 <Image
43 src={src}
44 alt={alt || ""}
45 width={imageMetadata.width}
46 height={imageMetadata.height}
47 placeholder={imageMetadata.blurDataURL ? "blur" : "empty"}
48 blurDataURL={imageMetadata.blurDataURL}
49 style={{
50 maxWidth: "100%",
51 height: "auto",
52 }}
53 className="rounded-[10px]"
54 />
55 );
56}

๋‹จ์ˆœํžˆ readFileSync๋ฅผ readFile๋กœ ๋ฐ”๊ฟ”์คฌ๋‹ค. (์งœ์ž”~) ๊ทธ๋ฆฌ๊ณ  plaiceholder ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ์ด์šฉํ•ด ์ด๋ฏธ์ง€๊ฐ€ ๋œ ๋กœ๋”ฉ ๋˜์—ˆ์„ ๋•Œ, ๋ธ”๋Ÿฌ ์ฒ˜๋ฆฌ๋ฅผ ํ•ด์ฃผ์—ˆ๋‹ค. ๊ณผ์—ฐ ์ด ๋‘˜์˜ ์„ฑ๋Šฅ ์ฐจ์ด๋Š” ์–ผ๋งˆ๋‚˜ ๋‚ ๊นŒ?

๊ทธ๋ž˜์„œ ์„ฑ๋Šฅ ์ฐจ์ด๊ฐ€ ์žˆ์–ด?

๊ฒฐ๋ก ๋ถ€ํ„ฐ ๋งํ•˜์ž๋ฉด, ์ฐจ์ด๊ฐ€ ์•„์ฃผ ๋ฏธ๋ฏธํ•˜๋‹ค. ๊ทธ๋ž˜์„œ ๋‚˜๋Š” ์–ด๋–จ ๋•Œ ์ฐจ์ด๊ฐ€ ๋ฐœ์ƒํ•˜๋Š”์ง€ ๊ถ๊ธˆํ•ด์„œ Artillery๋ฅผ ์ด์šฉํ•ด ๋ถ€ํ•˜ ํ…Œ์ŠคํŠธ๋ฅผ ์ง„ํ–‰ํ–ˆ๋‹ค.

Artillery์˜ ์‹œ๋‚˜๋ฆฌ์˜ค๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™๋‹ค. ๋น„๋™๊ธฐ, ๋™๊ธฐ ๋‘˜ ๋‹ค ๋˜‘๊ฐ™์€ ์‹œ๋‚˜๋ฆฌ์˜ค์™€ ๋ถ€ํ•˜๋ฅผ ๊ฐ–๋Š”๋‹ค. ๋‹จ์ง€ url์ด โ€˜/test-asyncโ€™์ธ์ง€ โ€˜/test-syncโ€™์ธ์ง€์— ๋Œ€ํ•œ ์ฐจ์ด๋งŒ ์žˆ๋‹ค.

test.yaml
1config:
2 target: "http://localhost:3000"
3 phases:
4 - name: "์ดˆ๊ธฐ ์ค€๋น„ ๋‹จ๊ณ„"
5 duration: 10
6 arrivalRate: 100 # ์ฒซ 10์ดˆ ๋™์•ˆ ์ดˆ๋‹น 50๋ช…
7 - name: "์ค‘๊ฐ„ ๋ถ€ํ•˜ ๋‹จ๊ณ„"
8 duration: 10
9 arrivalRate: 500 # ๋‹ค์Œ 10์ดˆ ๋™์•ˆ ์ดˆ๋‹น 100๋ช…
10 - name: "๊ณ ๋ถ€ํ•˜ ๋‹จ๊ณ„"
11 duration: 20
12 arrivalRate: 1000 # ๋งˆ์ง€๋ง‰ 20์ดˆ ๋™์•ˆ ์ดˆ๋‹น 200๋ช…
13scenarios:
14 - name: "ํ…Œ์ŠคํŠธ ์—”๋“œํฌ์ธํŠธ"
15 flow:
16 - get:
17 url: "/test-async"

ํ…Œ์ŠคํŠธ ๊ฒฐ๊ณผ

์™ผ์ชฝ์ด ๋น„๋™๊ธฐ, ์˜ค๋ฅธ์ชฝ์ด ๋™๊ธฐ์ด๋‹ค.

๋ถ€ํ•˜ํ…Œ์ŠคํŠธ ๊ฒฐ๊ณผ1 ๋ถ€ํ•˜ํ…Œ์ŠคํŠธ ๊ฒฐ๊ณผ2 ๋ถ€ํ•˜ํ…Œ์ŠคํŠธ ๊ฒฐ๊ณผ3

์‚ฌ์‹ค ๋‘˜์˜ ์ฐจ์ด๋Š” ๊ฑฐ์˜ ์—†๋‹ค. (ํ•˜ํ•˜ํ•˜) ์ด๋ ‡๊ฒŒ ๊ฒฐ๋ก ์„ ๋งบ์œผ๋ฉด ์žฌ๋ฏธ๊ฐ€ ์—†์œผ๋‹ˆ๊นŒ! ๋ฐ์ดํ„ฐ๋ฅผ ์ข€๋งŒ ๋” ๋ถ„์„ํ•ด๋ณด์ž.

์šฐ์„ , ํŠธ๋ž˜ํ”ฝ์ด ์ ์€ ์ƒํ™ฉ์—์„œ๋Š” ๋™๊ธฐ์™€ ๋น„๋™๊ธฐ ๋ฐฉ์‹ ๋ชจ๋‘ ํ‰๊ท  ์‘๋‹ต ์‹œ๊ฐ„์ด 0ms ์ •๋„๋กœ ๋น„์Šทํ•˜๊ฒŒ ๋™์ž‘ํ–ˆ๋‹ค. ํ•˜์ง€๋งŒ ๋ถ€ํ•˜๊ฐ€ ์ฆ๊ฐ€ํ• ์ˆ˜๋ก ๋‘ ๋ฐฉ์‹์˜ ํŠน์„ฑ์ด ๋ช…ํ™•ํ•˜๊ฒŒ ๋“œ๋Ÿฌ๋‚ฌ๋‹ค.

  1. ์ €๋ถ€ํ•˜ ํ™˜๊ฒฝ(100 RPS)

    ๋‘ ๋ฐฉ์‹ ๋ชจ๋‘ ํ‰๊ท  ์‘๋‹ต ์‹œ๊ฐ„์ด ์•ฝ 0ms๋กœ ๋น ๋ฅด๊ฒŒ ๋™์ž‘ํ–ˆ์œผ๋ฉฐ, ์ง€์—ฐ ์‹œ๊ฐ„๋„ ๋ฏธ๋ฏธํ–ˆ๋‹ค. ์ด ๊ตฌ๊ฐ„์—์„œ๋Š” ํฐ ์ฐจ์ด๋ฅผ ๋Š๋‚„ ์ˆ˜ ์—†์—ˆ๋‹ค.

  2. ์ค‘๊ฐ„ ๋ถ€ํ•˜ ํ™˜๊ฒฝ(500 RPS)

    • ๋น„๋™๊ธฐ ๋ฐฉ์‹
      ๋น„๋™๊ธฐ ์ฒ˜๋ฆฌ ๋•๋ถ„์— ๋Œ€๋ถ€๋ถ„์˜ ์š”์ฒญ์ด ๊ฑฐ์˜ ์ฆ‰์‹œ ์‘๋‹ต๋˜์—ˆ๊ณ , P95 ๊ธฐ์ค€ ์‘๋‹ต ์‹œ๊ฐ„์ด 50ms ์ดํ•˜๋กœ ์•ˆ์ •์ ์œผ๋กœ ์œ ์ง€๋˜์—ˆ๋‹ค. ์—ฌ๊ธฐ์„œ๋ถ€ํ„ฐ๋Š” ๋™๊ธฐ ๋ฐฉ์‹๊ณผ ์ดˆ๋‹น ์ฒ˜๋ฆฌํ•˜๋Š” ์š”์ฒญ์—์„œ ์กฐ๊ธˆ ๋” ์•ž์„œ๋‚˜๊ฐ”๋‹ค.
    • ๋™๊ธฐ ๋ฐฉ์‹
      ๋™๊ธฐ ๋ฐฉ์‹์€ ํ•œ ๋ฒˆ์— ํ•˜๋‚˜์”ฉ ์ฒ˜๋ฆฌํ•˜๊ธฐ ๋•Œ๋ฌธ์— ์ผ๋ถ€ ์š”์ฒญ์ด ๋Œ€๊ธฐํ•˜๋ฉด์„œ P95 ์‘๋‹ต ์‹œ๊ฐ„์ด ์•ฝ 150ms๊นŒ์ง€ ์ƒ์Šนํ–ˆ๋‹ค.
  3. ๊ณ ๋ถ€ํ•˜ ํ™˜๊ฒฝ(์˜ˆ: 1000 RPS)

    • ๋™๊ธฐ ๋ฐฉ์‹
      ๋™๊ธฐ ๋ฐฉ์‹์€ ๊ฐœ๋ณ„ ์š”์ฒญ์˜ ์ฒ˜๋ฆฌ ์‹œ๊ฐ„์€ ์ƒ๋Œ€์ ์œผ๋กœ ๋‚ฎ์•˜์ง€๋งŒ, ๋™์‹œ ์š”์ฒญ์ด ๋ชฐ๋ฆฌ๋ฉด์„œ ํด๋ผ์ด์–ธํŠธ ์ธก ํฌํŠธ ๊ณ ๊ฐˆ(EADDRINUSE) ๋“ฑ์˜ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•ด ์ „์ฒด ์„ฑ๊ณต๋ฅ ์ด ๋‚ฎ์•„์กŒ๊ณ , P95 ๋ฐ P99 ์‘๋‹ต ์‹œ๊ฐ„๋„ ํฌ๊ฒŒ ์ฆ๊ฐ€ํ–ˆ๋‹ค.
    • ๋น„๋™๊ธฐ ๋ฐฉ์‹
      ๋น„๋™๊ธฐ ๋ฐฉ์‹์€ ์ดˆ๊ธฐ ๋™์‹œ ์ฒ˜๋ฆฌ์—์„œ ํšจ์œจ์ ์ด์—ˆ์œผ๋‚˜ ์ž„๊ณ„ ๋ถ€ํ•˜๋ฅผ ๋„˜์–ด์„œ๋ฉด ์„œ๋ฒ„์—์„œ ๋‹ค๋Ÿ‰์˜ ์—ฐ๊ฒฐ ๊ฑฐ๋ถ€(ECONNREFUSED) ์˜ค๋ฅ˜์™€ ํ•จ๊ป˜ ์‘๋‹ต ์ง€์—ฐ์ด ๊ธ‰์ฆํ–ˆ๋‹ค. ์ด๋Š” I/O์™€ ๋‚ด๋ถ€ ๋ฆฌ์†Œ์Šค๊ฐ€ ํฌํ™” ์ƒํƒœ์— ์ด๋ฅด๋ €๊ธฐ ๋•Œ๋ฌธ์ด๋‹ค.

๊ฒฐ๋ก ์ ์œผ๋กœ, ์ €๋ถ€ํ•˜์—์„œ ์ค‘๋ถ€ํ•˜๊นŒ์ง€๋Š” ๋น„๋™๊ธฐ ๋ฐฉ์‹์ด ์‘๋‹ต ์ง€์—ฐ ์—†์ด ๋” ์•ˆ์ •์ ์œผ๋กœ ๋™์ž‘ํ–ˆ์œผ๋‚˜, ๊ณ ๋ถ€ํ•˜ ํ™˜๊ฒฝ์—์„œ๋Š” ๋‘ ๋ฐฉ์‹ ๋ชจ๋‘ ํ•œ๊ณ„์— ๋„๋‹ฌํ•ด ์‘๋‹ต ์ง€์—ฐ๊ณผ ์‹คํŒจ์œจ์ด ๊ธ‰๊ฒฉํžˆ ์ฆ๊ฐ€ํ–ˆ๋‹ค.

๋™๊ธฐ ๋ฐฉ์‹์€ ๊ฐœ๋ณ„ ์š”์ฒญ์˜ ์ง€์—ฐ์„ ๋‚ฎ๊ฒŒ ์œ ์ง€ํ–ˆ์ง€๋งŒ, ์ „์ฒด ์ฒ˜๋ฆฌ๋Ÿ‰ ์ธก๋ฉด์—์„œ๋Š” ํด๋ผ์ด์–ธํŠธ ์ž์› ๊ณ ๊ฐˆ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ–ˆ๋‹ค. ๋ฐ˜๋ฉด, ๋น„๋™๊ธฐ ๋ฐฉ์‹์€ ์ดˆ๊ธฐ์—๋Š” ๋†’์€ ์ฒ˜๋ฆฌ๋Ÿ‰์„ ๋ณด์˜€์œผ๋‚˜, ์ž„๊ณ„์น˜๋ฅผ ๋„˜์–ด์„œ๋ฉด ์„œ๋ฒ„ ์ž์› ๋ถ€์กฑ๊ณผ ์—ฐ๊ฒฐ ๊ฑฐ๋ถ€ ์˜ค๋ฅ˜๋กœ ์ธํ•ด ์„ฑ๋Šฅ์ด ๊ธ‰๋ฝํ–ˆ๋‹ค.

๋งŒ์•ฝ ํ˜„์—… ํ™˜๊ฒฝ์ด์—ˆ๋‹ค๋ฉด?

๋งŒ์•ฝ ์‹ค์ œ ์„œ๋ฒ„์—์„œ ์ด์ •๋„์˜ ๋ถ€ํ•˜๊ฐ€ ๋ฐœ์ƒํ–ˆ๋‹ค๋ฉด, ๋ฌด์กฐ๊ฑด ํ„ฐ์ง„๋‹ค. ๋”ฐ๋ผ์„œ ๋น„๋™๊ธฐ ๋ฐฉ์‹์˜ ์ด์ ์„ ์‚ด๋ฆฌ๋˜, ์‚ฌ์ „์— ์ด๋ฏธ์ง€ ์ฒ˜๋ฆฌ(๋ฆฌ์‚ฌ์ด์ง•, placeholder ์ƒ์„ฑ)๋ฅผ ํ•ด๋‘๊ณ  ์บ์‹œ๋ฅผ ํ™œ์šฉํ•˜๋ฉฐ, ์„œ๋น„์Šค ์ธํ”„๋ผ๋ฅผ ์ฆ์„คํ•˜์—ฌ ๋‹จ์ผ ์„œ๋ฒ„์— ๊ณผ๋ถ€ํ•˜๊ฐ€ ๊ฑธ๋ฆฌ์ง€ ์•Š๋„๋ก ์šด์˜ํ•˜๋Š” ๊ฒƒ์„ ์ƒ๊ฐํ•ด๋ณผ ์ˆ˜ ์žˆ๋‹ค.

์‚ฝ์งˆ(Feat: ๋„์ปค)

์›๋ž˜๋Š”, ๋นŒ๋“œํŒŒ์ผ์„ ๋„์ปค์— ๋„์›Œ์„œ ๋„์ปค์—์„œ cpu๋ฐ ๋ฉ”๋ชจ๋ฆฌ ์ž์›์„ ์กฐ์ ˆํ•ด๊ฐ€๋ฉด์„œ ๋ถ€ํ•˜ํ…Œ์ŠคํŠธ๋ฅผ ํ•ด๋ณด๋ ค ํ–ˆ์—ˆ๋‹ค. ๋„์ปค๋ฅผ ๊ฑฐ์˜ ์ฒ˜์Œ ์“ฐ๋‹ค๋ณด๋‹ˆ ์—„์ฒญ ํ—ค๋งธ์ง€๋งŒ ์–ด์ฐŒ์ €์ฐŒ ๋„์ปค ์ด๋ฏธ์ง€๋ฅผ ๋นŒ๋“œํ•˜์—ฌ ์ปจํ…Œ์ด๋„ˆ์— ์˜ฌ๋ ค์„œ ์‹คํ–‰๊นŒ์ง€ ์‹œ์ผฐ๋‹ค.

1docker run --cpus="12" --memory="1024m" -p 3000:3000 test

์œ„ ์ปค๋งจ๋“œ๋กœ ์‹คํ–‰์„ ์‹œํ‚ค๊ณ  ๋ถ€ํ•˜ํ…Œ์ŠคํŠธ๋ฅผ ํ•ด๋ณด์•˜๋Š”๋ฐ, ๋น„๋™๊ธฐ ํ…Œ์ŠคํŠธ์ธ๋ฐ๋„ ๋‹ค ์‹คํŒจ๋ฅผ ํ•˜๋Š” ๊ฑฐ์˜€๋‹ค. ๊ทธ๋ž˜์„œ ๋ถ€ํ•˜๋ฅผ ๊ฑฐ์˜ ์—†๋‹ค์‹œํ”ผ ์„ค์ •ํ•˜๊ณ  ํ…Œ์ŠคํŠธ๋ฅผ ํ•ด๋ณด์•˜๋‹ค. ๊ทธ๋Ÿฐ๋ฐ๋„ ๋ชจ๋‘ ์‹คํŒจํ–ˆ๋‹ค. . .๊ทธ๋ž˜์„œ ๋„์ปค์— ๋„์›Œ์„œ ํ•˜์ง€๋ง๊ณ  ๊ทธ๋ƒฅ ๋นŒ๋“œํŒŒ์ผ์„ next start๋กœ ๋„์šด ๋‹ค์Œ์— ๋ถ€ํ•˜๋ฅผ ๋งŽ์ด ๊ฑธ์–ด๋ณด๋Š” ๊ฑธ๋กœ ๋ฐ”๊ฟจ๋‹ค.

Prev
1phases:
2 - name: "์ดˆ๊ธฐ ์ค€๋น„ ๋‹จ๊ณ„"
3 duration: 10
4 arrivalRate: 50 # ์ฒซ 10์ดˆ ๋™์•ˆ ์ดˆ๋‹น 50๋ช…
5 - name: "์ค‘๊ฐ„ ๋ถ€ํ•˜ ๋‹จ๊ณ„"
6 duration: 10
7 arrivalRate: 100 # ๋‹ค์Œ 10์ดˆ ๋™์•ˆ ์ดˆ๋‹น 100๋ช…
8 - name: "๊ณ ๋ถ€ํ•˜ ๋‹จ๊ณ„"
9 duration: 20
10 arrivalRate: 200 # ๋งˆ์ง€๋ง‰ 20์ดˆ ๋™์•ˆ ์ดˆ๋‹น 200๋ช…
Now
1phases:
2 - name: "์ดˆ๊ธฐ ์ค€๋น„ ๋‹จ๊ณ„"
3 duration: 10
4 arrivalRate: 100 # ์ฒซ 10์ดˆ ๋™์•ˆ ์ดˆ๋‹น 100๋ช…
5 - name: "์ค‘๊ฐ„ ๋ถ€ํ•˜ ๋‹จ๊ณ„"
6 duration: 10
7 arrivalRate: 500 # ๋‹ค์Œ 10์ดˆ ๋™์•ˆ ์ดˆ๋‹น 500๋ช…
8 - name: "๊ณ ๋ถ€ํ•˜ ๋‹จ๊ณ„"
9 duration: 20
10 arrivalRate: 1000 # ๋งˆ์ง€๋ง‰ 20์ดˆ ๋™์•ˆ ์ดˆ๋‹น 1000๋ช…

๊ทธ ๊ฒฐ๊ณผ ๋‹คํ–‰ํžˆ ๊ฒฐ๊ณผ๊ฐ€ ๋‚˜์™”๋‹ค. (๋ชจ๋‘ ์‹คํŒจ๊ฐ€ ์•„๋‹Œ๊ฑฐ์— ๊ฐ์‚ฌํ•จ..ใ… ใ… ใ… )

์™œ ๋„์ปค๋กœ ๋„์šฐ๋ฉด ์•ˆ๋˜๋Š” ๊ฑด์ง€ ์•„์ง๋„ ์ž˜ ํŒŒ์•…ํ•˜์ง€ ๋ชปํ–ˆ๋‹ค. ๊ทธ๋Ÿฐ๋ฐ ์ปดํ“จํ„ฐ๋ฅผ ๊ป๋‹ค ํ‚ค๋ฉด ๋”ฑ ์ตœ์ดˆ 1ํšŒ๋Š” ๊ดœ์ฐฎ๊ฒŒ ๋‚˜์˜จ๋‹ค. ๊ทธ ์ดํ›„๋กœ๋Š” ์•„๋ฌด๋ฆฌ ์•ฝํ•œ ๋ถ€ํ•˜๋ฅผ ๊ฑธ์–ด๋„ ๋‹ค ์‹คํŒจ๋ฅผ ํ•œ๋‹ค. hmm.. ๋‚˜์ค‘์— ๊ผญ ์›์ธ์„ ๋ฐํžˆ๊ณ ์•ผ ๋ง๊ฒ ๋‹ค!