Skip to content

Commit 905091e

Browse files
committed
JMeter
1 parent 3b98a98 commit 905091e

File tree

7 files changed

+440
-23
lines changed

7 files changed

+440
-23
lines changed

README.md

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
It contains a React-based summarizer built with ChatGPT whose primary purpose of the application is to generate a summary of paragraphs with highlighting of the relevant keywords. It aims to facilitate the comprehension of the original text and to enhance user trust in the generated summary.
1515
</p>
1616
<p>
17-
<b>Tools</b>: <em>Docker, OpenAI, ReactJS, Flask (gunicorn + gevent), Celery (Redis), Nginx</em>
17+
<b>Tools</b>: <em>Docker, OpenAI, ReactJS, Flask (gunicorn + gevent), Celery (Redis + MongoDB), Nginx, JMeter</em>
1818
</p>
1919

2020
---
@@ -27,7 +27,9 @@
2727
- **Gevent**: it will allow web application to scale to potentially thousands of concurrent requests on a single process. It mainly replaces blocking parts with compatible cooperative counterparts from gevent package by "monkey patching". It uses epoll or kqueue or libevent for highly scalable non-blocking I/O.
2828
- **Celery**: Celery is a powerful and robust distributed task queue system that enables asynchronous task execution, scheduling, and distributed work processing. Celery supports distributing tasks across multiple workers, allowing applications to scale horizontally by adding more Celery workers as needed.
2929
- **Redis**: Redis provides a fast, lightweight, and efficient message queue system, making it suitable for handling large volumes of tasks and ensuring reliable task delivery.
30+
- **MongoDB**: Using MongoDB as the backend along with Redis as the message broker for Celery can provide a powerful and scalable solution for asynchronous task processing in web applications. While Redis is an excellent message broker, it is not designed for persistent storage of complex data structures like task results. MongoDB, on the other hand, provides a durable and scalable solution for storing task results, metadata, and other related information.
3031
- **Nginx**: NGINX is well known as a high‑performance load balancer, cache, and web server. It is often preferred over Linux Virtual Server (LVS) for load balancing and reverse proxying. It is a full-featured web server and reverse proxy, providing a complete solution with built-in load balancing, caching, access control, and other features. LVS, on the other hand, is primarily focused on load balancing and requires additional components for other functionalities.
32+
- **JMeter**: JMeter is a popular open-source tool used for load testing and performance testing of web applications, among other types of applications. JMeter generates detailed reports and graphs that help analyze the test results, including response times, throughput, and resource utilization. This information is valuable for identifying bottlenecks and optimizing the application's performance.
3133

3234
---
3335

@@ -82,10 +84,30 @@ You can start the broker to make the web appliaction more scalable with the comm
8284
The detailed configuration is under `backend/celeryconfig.py`
8385

8486

85-
#### Load Balance: Nginx (to-do)
87+
#### Load Balance: Nginx (TO-DO)
8688
Please see the configuration in `nginx.conf`. Run with
8789
- `nginx -g daemon off`
8890

91+
**Comment**: Currently, I am not familiar with the high-level Nginx operations.
92+
93+
94+
#### JMeter (Simple test: TO-DO)
95+
- See the files under `jmeter-tests`. In the figure below, Docker Desktop plug-in `qainsights/jmeter` with JMeter is used. In the test, I set the test with `time.sleep(2)` to complete the work.
96+
97+
<div align="center">
98+
<img src="examples/jmeter.png" style="width:70%">
99+
</div>
100+
101+
**Configuration**:
102+
- Image: qainsights/jmeter:latest
103+
- Volume: react-chatgpt/jmeter-tests:/jmeter-tests
104+
- Test plan: /jmeter-tests/web-test-plan.jmx
105+
- Proxy: host.docker.internal:8001
106+
- Logs: /jmeter-tests/run.log
107+
- Run.log: /jmeter-tests/result.jtl
108+
109+
**Comment**: Currently, I am trying to understand the concepts. Here is a just simple test demo.
110+
89111

90112
#### Development with Docker
91113
Docker is a good tool to deploy applications in different platforms. Here you can see we have `Dockerfile` in both `frontend/` and `backend/` folders and `docker-compose.yaml` in the directory. So, you can directly use the command `docker-compose -d up` with `docker` installed in your computer. I would recommend you to use Docker Desktop which can inspect the containers with GUI shown below.
@@ -96,14 +118,15 @@ Docker is a good tool to deploy applications in different platforms. Here you ca
96118
<img src="examples/nginx.png" style="width:70%">
97119
</div>
98120

121+
122+
99123
We can choose either Node or Nginx as the web server. The top figure is with Node, while the bottom figure is with Nginx. It is worth noticing that with Nginx, the frontend server with Node only need to complete the compilation.
100124

101125
The following figure shows the success deployment and some console log for your debegging in the web inspection mode.
102126
<div align="center">
103127
<img src="examples/inspection.png" style="width:90%">
104128
</div>
105129

106-
107130
### Usage
108131
<p>
109132
It is designed to be user-friendly and easily accessible to users with different technical backgrounds. To use the application, users may first follow the <a href="https://platform.openai.com/account/api-keys">link</a> on the first page to fetch their OpenAI API key which will be memorized before pressing the reset button, and paste the text to the form. After submitting the form, the original text will be rendered on the left side of the window, people may read some when they are waiting for the results from ChatGPT. After receiving the ChatGPT response, the browser will directly highlight the keywords in the original text and summary and compute the Jaccard similarity with respect to the keywords' appearance in the original text and summary.

backend/requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ openai
44
gunicorn
55
gevent
66
celery
7-
redis
7+
redis
8+
pymongo

docker-compose.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ services:
1414
environment:
1515
- FLASK_APP=server.py
1616
- CELERY_BROKER_URL=redis://redis:6379/1
17-
- CELERY_RESULT_BACKEND=redis://redis:6379/2
17+
- CELERY_RESULT_BACKEND=mongodb://mongo:27017
1818
command: ["gunicorn", "server:app", "-c", "./gunicorn.conf.py"]
1919
# ports:
2020
# - "8000:8000"
@@ -23,12 +23,16 @@ services:
2323
environment:
2424
- FLASK_APP=server.py
2525
- CELERY_BROKER_URL=redis://redis:6379/1
26-
- CELERY_RESULT_BACKEND=redis://redis:6379/2
26+
- CELERY_RESULT_BACKEND=mongodb://mongo:27017
2727
command: ["celery", "-A", "celery_task", "worker", "--loglevel=info"]
2828
redis:
2929
image: redis
3030
# ports:
3131
# - "6379:6379"
32+
mongo:
33+
image: mongo
34+
# ports:
35+
# - "27017:27017"
3236
nginx:
3337
image: nginx
3438
volumes:

examples/jmeter.png

343 KB
Loading

0 commit comments

Comments
 (0)