๊ด€๋ฆฌ ๋ฉ”๋‰ด

โœ๐Ÿป๊ธฐ๋กํ•˜๋Š” ๋ธ”๋กœ๊ทธ

[์„ฑ๋ŠฅํŠœ๋‹] ๋ฐ˜๋ณต์ ์ธ vault ์„œ๋ฒ„ ํ˜ธ์ถœ ์ œ๊ฑฐํ•˜๊ธฐ ๋ณธ๋ฌธ

ํ”„๋กœ์ ํŠธ/Heeverse

[์„ฑ๋ŠฅํŠœ๋‹] ๋ฐ˜๋ณต์ ์ธ vault ์„œ๋ฒ„ ํ˜ธ์ถœ ์ œ๊ฑฐํ•˜๊ธฐ

์ฉ์‹œํ‚ด 2023. 10. 26. 19:55
728x90

์„ฑ๋Šฅ ํ…Œ์ŠคํŠธ ์‹œ vuser ์ž„๊ณ„์น˜๋ฅผ ์„ค์ •ํ•˜๊ณ , Scouter๋ฅผ ํ†ตํ•œ ๋ณ‘๋ชฉ๊ตฌ๊ฐ„ ๋ถ„์„ํ•˜์—ฌ TPS๋ฅผ ๊ฐœ์„ ํ•œ ๊ฒฝํ—˜์„ ๊ณต์œ ํ•ฉ๋‹ˆ๋‹ค.

Scouter์˜ XLog ๋ถ„์„ํ•˜๊ธฐ

 

Scouter xLog

Scouter์˜ xLog๋ฅผ ๋“œ๋ž˜๊ทธํ•˜๋ฉด ๊ฐ ์‘๋‹ต๋งˆ๋‹ค ์•„๋ž˜์™€ ๊ฐ™์€ ํ•ญ๋ชฉ๋“ค์„ ๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

  1. Elasped Time
  2. CPU
  3. SQL Count
  4. SQL Time
  5. API Count
  6. API Time

์œ„์˜ ํ•ญ๋ชฉ ์ค‘ ์‘๋‹ต์†๋„ ๊ธฐ์ค€(Elasped Time)์œผ๋กœ ์ •๋ ฌํ•˜์—ฌ ๊ฐ€ ์ œ์ผ ์˜ค๋ž˜ ๊ฑธ๋ฆฐ ๊ตฌ๊ฐ„์„ ํ™•์ธํ–ˆ์Šต๋‹ˆ๋‹ค.

 

 

๋ˆˆ์— ๋„๋Š” ๊ตฌ๊ฐ„์€ ๋‘ ๊ตฌ๊ฐ„์ด ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค.

(1) ๊ตฌ๊ฐ„ - Ngrinder์˜ RampUp ์„ค์ •์œผ๋กœ ์ธํ•œ ์ดˆ๊ธฐ ์‘๋‹ต์†๋„ ์ง€์—ฐ๊ตฌ๊ฐ„์œผ๋กœ ์ถ”์ธกํ–ˆ์Šต๋‹ˆ๋‹ค.

(2) ๊ตฌ๊ฐ„ - API Time์ด ์˜ฌ๋ผ๊ฐ€์—ฌ ์ƒ์„ธ ํ˜ธ์ถœ ๋ฉ”์„œ๋“œ๋ฅผ ํ™•์ธํ•˜์˜€์Šต๋‹ˆ๋‹ค. 

 

 

ํ•ด๋‹น ๋ฉ”์„œ๋“œ๋Š” ngrinder ํ…Œ์ŠคํŠธ API ํ˜ธ์ถœ ์ „ Security Filter์ ์šฉ์„ ์œ„ํ•œ ์ ‘๊ทผ ๊ฐ€๋Šฅํ•œ url์ •๋ณด๋ฅผ vault์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›์•„์˜ค๋Š” ๋ฉ”์„œ๋“œ์˜€์Šต๋‹ˆ๋‹ค. ์ฝ”๋“œ๋ฅผ ํ™•์ธํ•˜๋ฉด ํ•ด๋‹น Filter๋ฅผ ๊ฒ€์‚ฌํ•˜๊ธฐ ์œ„ํ•ด vault ์„œ๋ฒ„๋ฅผ ํ˜ธ์ถœํ•˜๋Š” ๊ฒƒ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค.

 

 

๋ฐ˜๋ณต์ ์ธ ํ˜ธ์ถœ์„ ๊ฐœ์„ ํ•˜๊ธฐ ์œ„ํ•ด ์ ‘๊ทผ ๊ฐ€๋Šฅํ•œ url์„ ํ˜ธ์ถœํ•˜๋Š” ๋กœ์ง์„ Bean์œผ๋กœ ๋“ฑ๋กํ•˜์˜€์Šต๋‹ˆ๋‹ค. Application์ด ๋ถ€ํŒ…๋  ๋•Œ ํ•œ ๋ฒˆ๋งŒ ํ˜ธ์ถœํ•˜์—ฌ ๋ฐ˜๋ณต์ ์ธ ํ˜ธ์ถœ์„ ์ œ๊ฑฐํ•˜์˜€์Šต๋‹ˆ๋‹ค. UrlProps๋ผ๋Š” inner class๋ฅผ ๋‘์–ด url ์ •๋ณด๋ฅผ ๋‹ด์•˜์Šต๋‹ˆ๋‹ค. ์‚ฌ์šฉํ•˜๋Š” ์ชฝ์—์„œ NameSpace๋ฅผ ์•Œ ์ˆ˜ ์žˆ๋„๋ก Inner Class๋กœ ์ƒ์„ฑํ•˜์˜€์Šต๋‹ˆ๋‹ค.

 

@RequiredArgsConstructor
@Configuration
@EnableWebSecurity
public class SecurityConfig {

    private final ObjectMapper objectMapper;
    private final JwtTokenProvider jwtTokenProvider;
    private final VaultOperationService vaultOperationService;

    @Bean
    public UrlProps urlProps() {
        return vaultOperationService.getProps(VAULT_PATH, VAULT_URL_SECRETES, UrlProps.class);
    }

	//์ค‘๊ฐ„์ƒ๋žต
    
    public record UrlProps(String url) {
        public UrlProps {
            Assert.notNull(url, "url must not null");
        }
    }

}

 

shouldNotFilter ๋ฉ”์„œ๋“œ์—๋Š” bean์œผ๋กœ ๋™๋ฅต๋œ urlProps๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๋ฐ˜๋ณต์ ์ธ vault ์„œ๋ฒ„ ํ˜ธ์ถœ์„ ์ค„์˜€์Šต๋‹ˆ๋‹ค.

 

์„ฑ๋Šฅ ํŠœ๋‹ ๊ฒฐ๊ณผ

ํŠœ๋‹ ์ „ 376.2 TPS์—์„œ 400TPS๋กœ ๊ฐœ์„ ๋œ ๊ฒƒ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค. ์•„๋ž˜์™€ ๊ฐ™์ด ๋™์ผํ•œ ํ…Œ์ŠคํŠธ๋ฅผ 3๋ฒˆ ๋ฐ˜๋ณตํ•œ ์ด์œ ๋Š” ๋„คํŠธ์›Œํฌ ํ™˜๊ฒฝ ๋ฐ ์™ธ๋ถ€์š”์†Œ์— ์˜ํ•œ ์˜ํ–ฅ์„ ๊ณ ๋ คํ•˜์—ฌ ์„ฑ๋Šฅํ…Œ์ŠคํŠธ๋ฅผ ์„ธ๋ฒˆ ๋ฐ˜๋ณตํ•˜์—ฌ TPS๋ฅผ ๊ณ„์‚ฐํ•˜์˜€์Šต๋‹ˆ๋‹ค.

 


[์ฐธ๊ณ ]

์ฑ… - ์ž๋ฐ” ํŠธ๋Ÿฌ๋ธ” ์ŠˆํŒ…

์ฑ… - ์‹ค๋ฌด๋กœ ๋ฐฐ์šฐ๋Š” ์‹œ์Šคํ…œ ์„ฑ๋Šฅ ์ตœ์ ํ™”

 

728x90
๋ฐ˜์‘ํ˜•