Skip to content

Commit 2139e3e

Browse files
authored
[fix/#106] Elasticsearch 연동 에러 해결 및 속도 개선 (#107)
* fix: Elasticsearch Bean 제거로 Spring Boot가 자동으로 Bean 생성하도록 변경 * improve: ES 속도 향상을 위해 메모리 할당 증가 및 Redis 메모리 제한 설정
1 parent 8d95d16 commit 2139e3e

File tree

4 files changed

+16
-36
lines changed

4 files changed

+16
-36
lines changed

docker-compose.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@ services:
2929
restart: always
3030
ports:
3131
- "6379:6379"
32-
command: redis-server --requirepass ${REDIS_PASSWORD}
32+
command:
33+
redis-server
34+
--requirepass ${REDIS_PASSWORD}
35+
--maxmemory 256mb
36+
--maxmemory-policy allkeys-lru
3337
networks:
3438
- app-network
3539
volumes:
@@ -45,7 +49,7 @@ services:
4549
environment:
4650
- discovery.type=single-node
4751
- xpack.security.enabled=false
48-
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
52+
- "ES_JAVA_OPTS=-Xms1g -Xmx1g"
4953
networks:
5054
- app-network
5155
volumes:
Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
11
package com.techfork.global.config;
22

3-
import co.elastic.clients.elasticsearch.ElasticsearchClient;
4-
import co.elastic.clients.json.jackson.JacksonJsonpMapper;
5-
import co.elastic.clients.transport.rest_client.RestClientTransport;
6-
import org.apache.http.HttpHost;
7-
import org.elasticsearch.client.RestClient;
8-
import org.springframework.beans.factory.annotation.Value;
9-
import org.springframework.context.annotation.Bean;
103
import org.springframework.context.annotation.Configuration;
114
import org.springframework.data.elasticsearch.config.EnableElasticsearchAuditing;
125
import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories;
@@ -15,19 +8,4 @@
158
@EnableElasticsearchAuditing
169
@EnableElasticsearchRepositories(basePackages = "com.techfork")
1710
public class ElasticsearchConfig {
18-
19-
@Value("${elasticsearch.host:localhost}")
20-
private String elasticsearchHost;
21-
22-
@Value("${elasticsearch.port:9200}")
23-
private int elasticsearchPort;
24-
25-
@Bean
26-
public ElasticsearchClient elasticsearchClient() {
27-
RestClient restClient = RestClient.builder(
28-
new HttpHost(elasticsearchHost, elasticsearchPort, "http")).build();
29-
return new ElasticsearchClient(
30-
new RestClientTransport(restClient, new JacksonJsonpMapper())
31-
);
32-
}
3311
}

src/main/resources/application-dev.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,13 @@ recommendation:
7474
knn-search-size: 100
7575
num-candidates: 200
7676
mmr-final-size: 30
77-
lambda: 0.6
77+
lambda: 0.3
7878
active-user-hours: 24
7979
# 임베딩 가중치 설정 (합계 1.0)
8080
embedding-weights:
81-
title: 0.4 # 제목 중요도 40%
82-
summary: 0.4 # 요약 중요도 40%
83-
content: 0.2 # 콘텐츠 청크 중요도 20%
81+
title: 0.2
82+
summary: 0.2
83+
content: 0.6
8484
# 시간 감쇠 가중치 설정
8585
time-decay:
8686
days-7: 1.3 # 최근 7일: +30%
@@ -89,8 +89,7 @@ recommendation:
8989
days-over: 0.4 # 90일 이상: -60%
9090

9191
elasticsearch:
92-
host: elasticsearch
93-
port: 9200
92+
uris: http://elasticsearch:9200
9493

9594
logging:
9695
level:

src/main/resources/application-local.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,7 @@ scheduler:
6666
enabled: true
6767

6868
elasticsearch:
69-
host: localhost
70-
port: 9200
69+
uris: http://elasticsearch:9200
7170

7271
webhook:
7372
enabled: true
@@ -78,13 +77,13 @@ recommendation:
7877
knn-search-size: 100
7978
num-candidates: 200
8079
mmr-final-size: 30
81-
lambda: 0.6
80+
lambda: 0.3
8281
active-user-hours: 24
8382
# 임베딩 가중치 설정 (합계 1.0)
8483
embedding-weights:
85-
title: 0.4 # 제목 중요도 40%
86-
summary: 0.4 # 요약 중요도 40%
87-
content: 0.2 # 콘텐츠 청크 중요도 20%
84+
title: 0.2
85+
summary: 0.2
86+
content: 0.6
8887
# 시간 감쇠 가중치 설정
8988
time-decay:
9089
days-7: 1.3 # 최근 7일: +30%

0 commit comments

Comments
 (0)