Skip to content

Commit e295a8e

Browse files
committed
add load generate instance
1 parent baf6a43 commit e295a8e

File tree

5 files changed

+53
-1
lines changed

5 files changed

+53
-1
lines changed

docker-compose-ali.yml

+4
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@ services:
101101
- "nacos"
102102
- "product-mysql"
103103

104+
loadgenerator:
105+
build: ./src/loadgenerator
106+
image: registry.cn-shanghai.aliyuncs.com/microservice_demo/loadgenerator:1.0.0-SNAPSHOT
107+
container_name: loadgenerator
104108
# adservice:
105109
# build: ./src/adservice
106110
# image: adservice:1.0.0-SNAPSHOT

docker-compose.yml

+5
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,11 @@ services:
101101
- "nacos"
102102
- "product-mysql"
103103

104+
loadgenerator:
105+
build: ./src/loadgenerator
106+
image: registry.cn-shanghai.aliyuncs.com/microservice_demo/loadgenerator:1.0.0-SNAPSHOT
107+
container_name: loadgenerator
108+
104109
# adservice:
105110
# build: ./src/adservice
106111
# image: adservice:1.0.0-SNAPSHOT

kubernetes-manifests/quick-start/application.yaml

+42
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,48 @@ spec:
150150
limits:
151151
cpu: 1000m
152152
memory: 2048Mi
153+
154+
---
155+
156+
apiVersion: apps/v1
157+
kind: Deployment
158+
metadata:
159+
name: loadgenerator
160+
spec:
161+
selector:
162+
matchLabels:
163+
app: loadgenerator
164+
replicas: 1
165+
template:
166+
metadata:
167+
labels:
168+
app: loadgenerator
169+
spec:
170+
terminationGracePeriodSeconds: 5
171+
restartPolicy: Always
172+
containers:
173+
- name: main
174+
image: loadgenerator
175+
env:
176+
- name: LANG
177+
value: C.UTF-8
178+
- name: GPG_KEY
179+
value: 0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D
180+
- name: PYTHON_GET_PIP_URL
181+
value: https://github.com/pypa/get-pip/raw/404c9418e33c5031b1a9ab623168b3e8a2ed8c88/get-pip.py
182+
- name: PYTHON_GET_PIP_SHA256
183+
value: 56bb63d3cf54e7444351256f72a60f575f6d8c7f1faacffae33167afc8e7609d
184+
- name: FRONTEND_ADDR
185+
value: zuul-gateway-svc
186+
- name: USERS
187+
value: '20'
188+
resources:
189+
limits:
190+
cpu: 250m
191+
memory: 512Mi
192+
terminationMessagePath: /dev/termination-log
193+
terminationMessagePolicy: File
194+
153195
---
154196
apiVersion: v1
155197
kind: Service

src/cartservice/cartservice-provider/src/main/java/com/alibabacloud/hipstershop/cartserviceprovider/repository/RedisRepository.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public List<CartItem> getUserCartItems(String userId) {
4040

4141
public boolean removeUserCartItems(String userId) {
4242
//移除购物车商品
43-
// redisTemplate.delete(Common.getRedisKey(userId).getKey());
43+
redisTemplate.delete(Common.getRedisKey(userId).getKey());
4444
return true;
4545
}
4646

src/loadgenerator/locustfile.py

+1
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ def on_start(self):
7070
browseProduct: 10,
7171
addToCart: 2,
7272
viewCart: 3,
73+
checkout: 3
7374
}
7475

7576
class WebsiteUser(HttpLocust):

0 commit comments

Comments
 (0)