本文实例讲述了Python实现测试磁盘性能的方法。分享给大家供大家参考。具体如下:
该代码做了如下工作:
create 300000 files (512B to 1536B) with data from /dev/urandom
rewrite 30000 random files and change the size
read 30000 sequential files
read 30000 random files
delete all files
sync and drop cac
介绍
An open source load testing tool.
一个开源性能测试工具。
define user behaviour with python code, and swarm your system with millions of simultaneous users.
使用Python代码来定义用户行为。用它可以模拟百万计的并发用户访问你的系统。
官方网站:http://locust.io/
Locust安装
1、安装Python:
官方:https://www.
测试代码如下:
import timeit,time
from sys import getsizeof as Size
from collections import OrderedDict
import random
List_Test = list(range(5000))
print(The Size of List is : {}.format(Size(List_Test)))
Set_Test = set(range(5000))
print(The Size of Set is