简体   繁体   中英

Pyignite: connection timeout error when trying to load json into cache using put_all()

The code works when tried with fewer values but gives connection timeout error when tried with even 30k entries.

Sample code with sample json:

a = {}
for i in range(10000):
    a.update({"test"+str(i):((MapObject.HASH_MAP,
                 {"key_1": ((1,["value_1",1.0]),MapObject),
                  "key_2": ((1, [["value_2_1","1.0"],["value_2_2","0.25"]]),CollectionObject),
                  "key_3": ((1, [["value_3_1","1.0"],["value_3_2","0.25"]]),CollectionObject),
                  "key_4": ((1, [["value_4_1","1.0"],["value_4_2","0.25"]]),CollectionObject),
                  'key_5': False,
                  "key_6":"value_6"}),MapObject)})
test_cache.put_all(a)

Tried this

    a = {}
    for i in range(10000):
        a.update({"test" + str(i): ((MapObject.HASH_MAP,
                                     {"key_1": ((1, ["value_1", 1.0]), CollectionObject),
                                      "key_2": ((1, [["value_2_1", "1.0"], ["value_2_2", "0.25"]]), CollectionObject),
                                      "key_3": ((1, [["value_3_1", "1.0"], ["value_3_2", "0.25"]]), CollectionObject),
                                      "key_4": ((1, [["value_4_1", "1.0"], ["value_4_2", "0.25"]]), CollectionObject),
                                      'key_5': False,
                                      "key_6": "value_6"}), MapObject)})
    start = time.time()
    cache.put_all(a)
    print(f'duration {time.time() - start}')

on master branch -- works as expected, took about 7 sec. to complete against 4 ignite nodes on average laptop. We will release 0.4.0 soon, stay tuned!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM