Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
6a756c7
empty
juchiast Nov 21, 2019
e1016d5
Rename stuffs
juchiast Nov 22, 2019
d43c428
Fix queries
juchiast Nov 22, 2019
527545d
Rename stuffs
juchiast Nov 22, 2019
bc6125d
Fix queries
juchiast Nov 22, 2019
6aed518
Implement search api (#3)
juchiast Nov 23, 2019
dc481b9
Impl worker ID
juchiast Nov 23, 2019
8ed459a
no main
juchiast Nov 23, 2019
9f96f0f
impl
juchiast Nov 23, 2019
28534bd
init
qcuong98 Nov 23, 2019
73dba60
fix select form
qcuong98 Nov 23, 2019
b7efbd4
hmmm
qcuong98 Nov 24, 2019
7ada6c9
raw
qcuong98 Nov 24, 2019
c25427f
raww
qcuong98 Nov 24, 2019
9c05188
example messages
juchiast Nov 25, 2019
f0733b4
example messages
juchiast Nov 25, 2019
bc02f54
CORS allows all
juchiast Nov 25, 2019
b3cfe67
fetch and send messages
juchiast Nov 25, 2019
d0ff39b
rawww
qcuong98 Nov 25, 2019
fd8ca96
add Dockerfile
juchiast Nov 25, 2019
777362f
host settings
juchiast Nov 25, 2019
ad58533
add dockerfile
juchiast Nov 25, 2019
65f716c
raww
qcuong98 Nov 25, 2019
eccda6b
reformat
qcuong98 Nov 25, 2019
4ed5d97
Client (#5)
juchiast Nov 25, 2019
ec07d29
Merge branch 'master' into delayed-inserter
juchiast Nov 25, 2019
a487ce9
crawl vnexpress
qcuong98 Nov 26, 2019
fa38d7e
Merge pull request #6 from juchiast/client
qcuong98 Nov 26, 2019
8b8d55f
remove swp
juchiast Nov 27, 2019
49b34f7
Merge branch 'master' into delayed-inserter
juchiast Nov 27, 2019
fd5301d
add client dockerfile
juchiast Nov 27, 2019
02cb829
deploy DB
juchiast Nov 27, 2019
a026a68
.
juchiast Nov 27, 2019
fc123ad
.
juchiast Nov 27, 2019
bf38c20
rip
juchiast Nov 27, 2019
0c41ab4
rip
juchiast Nov 27, 2019
e7cf58f
.
juchiast Nov 27, 2019
56c77b9
change domain
juchiast Nov 28, 2019
bb62606
add websocket
Nov 29, 2019
7cf2f2e
.
juchiast Nov 29, 2019
34b9295
Merge
juchiast Nov 29, 2019
01e1c92
ws
juchiast Nov 29, 2019
5f3af01
ws
juchiast Nov 29, 2019
6c60509
ws
juchiast Nov 29, 2019
26d0575
fix
juchiast Nov 29, 2019
46fb299
.
juchiast Nov 29, 2019
ea428cf
.
juchiast Nov 29, 2019
e7c1614
batch write
juchiast Nov 29, 2019
5c1a027
prepare for benchmark
juchiast Nov 30, 2019
f693aa4
kill service worker
juchiast Nov 30, 2019
68e5a68
bench code
juchiast Nov 30, 2019
81404cd
reconnect
juchiast Nov 30, 2019
8a544cd
empty
juchiast Nov 30, 2019
63b7693
compose
juchiast Nov 30, 2019
8d78fa7
smaller batch
juchiast Nov 30, 2019
2ab45f8
stuff
juchiast Nov 30, 2019
1916ea6
Merge pull request #4 from juchiast/delayed-inserter
juchiast Dec 3, 2019
9d53596
Update README.md
qcuong98 Jun 10, 2020
501e7b7
Bump aiohttp from 3.6.2 to 3.7.4 in /bench
dependabot[bot] Feb 26, 2021
e309813
Bump flask-cors from 3.0.8 to 3.0.9 in /rest-in-peace
dependabot[bot] May 6, 2021
fc6d016
Merge pull request #9 from juchiast/dependabot/pip/rest-in-peace/flas…
juchiast May 24, 2021
237885d
Merge pull request #8 from juchiast/dependabot/pip/bench/aiohttp-3.7.4
juchiast May 24, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
**/__pycache__
**/.ipynb_checkpoints
.idea
**/vnexpress_article_links.txt
**/sentences.txt
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# chat

https://paper.dropbox.com/doc/CHAT-tPo5eMiyeC4HhRyqojC2E

# Run code

Run database:
Expand All @@ -24,3 +20,11 @@ Insert messages:
```
python3 raw_data/setup_data.py
```

# Ref

- https://blog.discordapp.com/how-discord-indexes-billions-of-messages-e3d5e9be866f
- https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping.html
- https://kubernetes.io/docs/tutorials/stateless-application/guestbook/
- https://kubernetes.io/docs/tutorials/stateful-application/cassandra/
- https://medium.com/faun/deploying-a-cassandra-cluster-in-kubernetes-on-ibm-cloud-59e840c1a9b7
11 changes: 11 additions & 0 deletions bench/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM python:3

WORKDIR /usr/src/app

COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt

COPY . .
RUN rm -rf __py_cache__

CMD [ "python", "bench.py" ]
37 changes: 37 additions & 0 deletions bench/bench.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import aiohttp
import random
import json
import asyncio

host = "https://chat.vietcodes.com/api"
rooms = [1, 2, 3, 4, 5, 6]
users = ['lisa', 'kenny', 'voldy']
size = 600000

async def main():
f = open("./sentences.txt", 'r')
session = aiohttp.ClientSession()
futures = []
for i in range(size):
text = f.readline()
room = random.choice(rooms)
user = random.choice(users)
url = f"{host}/{room}/"
data = {
'user_name': user,
'message': text,
}
await session.post(url, json=data)
if i % 80 == 0:
words = text.split(" ")
query = random.choice(words)
search_url = f"{url}search/"
data = {
'query': query,
}
await session.post(search_url, json=data)

f.close()


asyncio.run(main())
8 changes: 8 additions & 0 deletions bench/build.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -Eeuxo pipefail

ROOT=$PWD/../

cd ${ROOT}/bench
docker build -t juchiast/chat-bench:latest .
docker push juchiast/chat-bench:latest
4 changes: 4 additions & 0 deletions bench/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
version: "3.7"
services:
bench:
image: juchiast/chat-bench:latest
1 change: 1 addition & 0 deletions bench/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
aiohttp==3.7.4
23 changes: 23 additions & 0 deletions chat-client/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
3 changes: 3 additions & 0 deletions chat-client/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"editor.tabSize": 2
}
3 changes: 3 additions & 0 deletions chat-client/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM nginx

COPY . /usr/share/nginx/html
68 changes: 68 additions & 0 deletions chat-client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).

## Available Scripts

In the project directory, you can run:

### `npm start`

Runs the app in the development mode.<br />
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.

The page will reload if you make edits.<br />
You will also see any lint errors in the console.

### `npm test`

Launches the test runner in the interactive watch mode.<br />
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.

### `npm run build`

Builds the app for production to the `build` folder.<br />
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.<br />
Your app is ready to be deployed!

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.

### `npm run eject`

**Note: this is a one-way operation. Once you `eject`, you can’t go back!**

If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.

You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.

## Learn More

You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).

To learn React, check out the [React documentation](https://reactjs.org/).

### Code Splitting

This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting

### Analyzing the Bundle Size

This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size

### Making a Progressive Web App

This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app

### Advanced Configuration

This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration

### Deployment

This section has moved here: https://facebook.github.io/create-react-app/docs/deployment

### `npm run build` fails to minify

This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify
Loading