254 Star 1.9K Fork 452

GVPsjqzhang / go-fastdfs

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
benchmark.py 715 Bytes
一键复制 编辑 原始数据 按行查看 历史
sjqzhang 提交于 2019-10-09 16:59 . add golang benchmark
# -*- coding: utf-8 -*-
import requests
import gevent
from Queue import Queue
q=Queue()
import commands
from gevent import monkey
monkey.patch_all()
import os
out=commands.getoutput('find . -type f')
lines=out.split("\n")
for i in lines:
q.put(i)
def task():
while True:
name=q.get(block=False)
if name=="":
break
url = 'http://10.1.5.20:8080/group1/upload'
files = {'file': open(name, 'rb')}
options = {'output': 'json', 'path': '', 'scene': ''}
try:
r = requests.post(url, files=files)
except Exception as er:
print(er)
th=[]
for i in range(200):
th.append(gevent.spawn(task))
gevent.joinall(th)
Go
1
https://gitee.com/sjqzhang/go-fastdfs.git
git@gitee.com:sjqzhang/go-fastdfs.git
sjqzhang
go-fastdfs
go-fastdfs
master

搜索帮助