A backend microservice framework.
Project description
ark
创建
ark create run.arkio.demo
WSGI
启动
ark serve --wsgi
or
gunicorn demo.app:app --reload
测试
curl "http://127.0.0.1:8000/"
压测
ab -n 10000 -c 100 -t 10 "http://127.0.0.1:8000/"
GRPC
启动
ark serve
测试
grpcurl -plaintext 127.0.0.1:50051 list
grpcurl -plaintext -d '{"name": "ark"}' 127.0.0.1:50051 helloworld.Greeter/SayHello
grpcurl -plaintext -d '{"name": "redis"}' 127.0.0.1:50051 helloworld.Greeter/SayHello
grpcurl -plaintext -d '{"name": "kafka"}' 127.0.0.1:50051 helloworld.Greeter/SayHello
grpcurl -plaintext -d '{"name": "rabbit"}' 127.0.0.1:50051 helloworld.Greeter/SayHello
grpcurl -plaintext -d '{"name": "ark"}' 127.0.0.1:50051 helloworld.Greeter/SayHelloAsync
grpcurl -plaintext -d '{"name": "rpc"}' 127.0.0.1:50051 helloworld.Greeter/SayHelloAsync
压测
# ecs.c6.large 2vCPU/4GiB
ghz --insecure --async \
--call helloworld.Greeter/SayHello \
-c 1000 -n 20000 --rps 5000 \
-d '{"name":"ark"}' 172.26.1.198:50051
运行模式
- ark serve --wsgi
- ark serve
- ark worker
- ark consumer
- ark shell
- ark run
- ark test
- ark lint
基础设施
redis
docker run -d --hostname redis --name redis -p 6379:6379 redis
rabbitmq
docker run -d --hostname rabbit --name rabbit -p 5672:5672 -p 15672:15672 rabbitmq:3-management
kafka
export KAFKA_ADVERTISED_HOST_NAME=172.26.1.199
docker rm -f kafka
docker rm -f zookeeper
docker run -d --name zookeeper -p 2181:2181 -t wurstmeister/zookeeper
docker run -d --name kafka -p 9092:9092 --link zookeeper -e KAFKA_ZOOKEEPER_CONNECT=zookeeper:2181 -e KAFKA_ADVERTISED_HOST_NAME=$KAFKA_ADVERTISED_HOST_NAME -e KAFKA_ADVERTISED_PORT=9092 wurstmeister/kafka:2.12-2.4.0
docker exec -it kafka bash
kafka-topics.sh --zookeeper zookeeper:2181 --list
kafka-topics.sh --zookeeper zookeeper:2181 --delete --topic topic01
kafka-topics.sh --zookeeper zookeeper:2181 --create --topic topic01 --replication-factor 1 --partitions 5
elasticsearch
docker run --name elasticsearch -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" -d elasticsearch:7.2.0
curl http://localhost:9200
elasticsearch-kibana
docker run --name kibana --link=elasticsearch:test -p 5601:5601 -d kibana:7.2.0
必备工具
grpcurl
# mac
brew install grpcurl
# linux
https://github.com/fullstorydev/grpcurl/releases/download/v1.8.6/grpcurl_1.8.6_linux_x86_64.tar.gz
[文档] https://github.com/fullstorydev/grpcurl
ghz
# mac
brew install ghz
# linux
wget https://github.com/bojand/ghz/releases/download/v0.108.0/ghz-linux-x86_64.tar.gz
[文档] https://ghz.sh/docs/usage
protobuf
# mac
brew install protobuf
# linux
PROTOC_ZIP=protoc-3.14.0-osx-x86_64.zip
curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v3.14.0/$PROTOC_ZIP
sudo unzip -o $PROTOC_ZIP -d /usr/local bin/protoc
sudo unzip -o $PROTOC_ZIP -d /usr/local 'include/*'
rm -f $PROTOC_ZIP
[文档] http://google.github.io/proto-lens/installing-protoc.html
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
arkio-0.0.4.tar.gz
(28.6 kB
view details)
File details
Details for the file arkio-0.0.4.tar.gz
.
File metadata
- Download URL: arkio-0.0.4.tar.gz
- Upload date:
- Size: 28.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ac5977d7a1ea498688960d39d3b6555bbf99b379407db1ffd0d44d3e7533d851 |
|
MD5 | ce5435d10aee975ef948c497e52fc55f |
|
BLAKE2b-256 | 426fe84aaa488ab8a2166e1436fe933334131fd73bed299acecc1e6968ccd885 |