[skip ci] Test chaos memory stress datanode (#10610)

Signed-off-by: ThreadDao <yufen.zong@zilliz.com>
pull/10613/head
ThreadDao 2021-10-25 21:32:18 +08:00 committed by GitHub
parent 42480da5d3
commit 55ceb752af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 62 additions and 5 deletions

View File

@ -0,0 +1,18 @@
kind: StressChaos
apiVersion: chaos-mesh.org/v1alpha1
metadata:
name: test-datanode-memory-stress
namespace: chaos-testing
spec:
selector:
namespaces:
- chaos-testing
labelSelectors:
app.kubernetes.io/name: milvus
app.kubernetes.io/instance: mic-memory
app.kubernetes.io/component: datanode
mode: one
stressors:
memory:
workers: 4
size: 512Mi

View File

@ -1,7 +1,7 @@
kind: StressChaos
apiVersion: chaos-mesh.org/v1alpha1
metadata:
name: test-pod-memory-stress
name: test-querynode-memory-stress
namespace: chaos-testing
spec:
selector:

View File

@ -61,7 +61,7 @@ class TestChaosData:
collection_w = construct_from_data(c_name)
log.debug(collection_w.schema)
# reboot a pod
# apply memory stress
apply_memory_stress(chaos_yaml)
# wait memory stress
@ -91,11 +91,50 @@ class TestChaosData:
@pytest.mark.tags(CaseLabel.L3)
@pytest.mark.parametrize('chaos_yaml', get_chaos_yamls())
def test_chaos_memory_stress_datanode(self, connection, chaos_yaml):
pass
def test_chaos_memory_stress_datanode(self, chaos_yaml):
"""
target: test inject memory stress into dataNode
method: 1.Deploy milvus and limit datanode memory resource
2.Create collection and insert some data
3.Inject memory stress chaos
4.Continue to insert data
expected:
"""
# init collection and insert 250 nb
nb = 25000
dim = 512
c_name = cf.gen_unique_str('chaos_memory')
collection_w = ApiCollectionWrapper()
collection_w.init_collection(name=c_name,
schema=cf.gen_default_collection_schema(dim=dim))
for i in range(10):
t0 = datetime.datetime.now()
df = cf.gen_default_dataframe_data(nb=nb, dim=dim)
res = collection_w.insert(df)[0]
assert res.insert_count == nb
log.info(f'After {i+1} insert, num_entities: {collection_w.num_entities}')
tt = datetime.datetime.now() - t0
log.info(f"{i} insert and flush data cost: {tt}")
# inject memory stress
chaos_config = gen_experiment_config(chaos_yaml)
log.debug(chaos_config)
chaos_res = CusResource(kind=chaos_config['kind'],
group=constants.CHAOS_GROUP,
version=constants.CHAOS_VERSION,
namespace=constants.CHAOS_NAMESPACE)
chaos_res.create(chaos_config)
log.debug("chaos injected")
# Continue to insert data
collection_w.insert(df)
log.info(f'Total num entities: {collection_w.num_entities}')
# delete chaos
meta_name = chaos_config.get('metadata', None).get('name', None)
chaos_res.delete(metadata_name=meta_name)
@pytest.mark.tags(CaseLabel.L3)
@pytest.mark.parametrize('chaos_yaml', get_chaos_yamls())
def test_chaos_memory_stress_indexnode(self, connection, chaos_yaml):
pass