Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/winlinvip/study-coroutine
https://github.com/winlinvip/study-coroutine
Last synced: 6 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/winlinvip/study-coroutine
- Owner: winlinvip
- License: mit
- Created: 2019-10-06T02:20:35.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-10-07T00:08:25.000Z (over 5 years ago)
- Last Synced: 2025-01-02T12:09:55.178Z (9 days ago)
- Language: C
- Size: 123 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Study Coroutine
Study ST(state-threads) and Go(goroutine).
## Usage
First, clone this git and start docker:
```
docker pull ossrs/dev &&
git clone https://github.com/winlinvip/study-coroutine.git &&
cd study-coroutine && docker run -it -v `pwd`:/tmp -w /tmp ossrs/dev bash
```Second, build all:
```
(cd st-server/st-1.9 && make EXTRA_CFLAGS=-DMALLOC_STACK linux-debug) &&
(cd st-server && g++ -Ist-1.9/obj -g -O0 main.cpp st-1.9/obj/libst.a -o st-server) &&
(cd go-client && go build .) &&
(cd go-server && go build .)
```## ST(state-threads)
Run st-server:
```
docker run -it -v `pwd`:/tmp -w /tmp ossrs/dev ./st-server/st-server
```Run go-client with 10k connections:
```
dockerID=`docker ps --format "{{.ID}} {{.Image}}" |grep 'ossrs/dev' |awk '{print $1}'` &&
docker exec -it $dockerID ./go-client/go-client -c 60000 -s 90
```To stop server:
```
docker kill `docker ps --format "{{.ID}} {{.Image}}" |grep 'ossrs/dev' |awk '{print $1}'`
```## Go
Run go-server:
```
docker run -it -v `pwd`:/tmp -w /tmp ossrs/dev ./go-server/go-server
```Run go-client with 10k connections:
```
dockerID=`docker ps --format "{{.ID}} {{.Image}}" |grep 'ossrs/dev' |awk '{print $1}'` &&
docker exec -it $dockerID ./go-client/go-client -c 60000 -s 90
```To stop server:
```
docker kill `docker ps --format "{{.ID}} {{.Image}}" |grep 'ossrs/dev' |awk '{print $1}'`
```