bootcamp icon indicating copy to clipboard operation
bootcamp copied to clipboard

[BUG]: use fastapi search text slowly

Open ZTurboX opened this issue 3 years ago • 1 comments
trafficstars

Is there an existing issue for this?

  • [X] I have searched the existing issues

Current Behavior

use fastapi search text if add async search slowly if not add async search fastly but memory glow fastly ` @app.post("/v1/api/search") async def search(item: SearchItem):

sentence = item.sentence
idx = item.idx
results = item.dict()
try:
    result = search_in_milvus(sentence, idx, DEFAULT_TABLE, MODEL, MILVUS_CLI, PGSQL_CLI)
    if len(result) > 0:
        results["data"] = result[0]
        LOGGER.info("Successfully searched similar text!")
    return results
except Exception as e:
    LOGGER.error(e)
    return {'status': False, 'msg': e}, 400

`

Expected Behavior

No response

Steps To Reproduce

No response

Software version

Milvus:  2.0.0rc1
fastapi:0.65.2

Anything else?

No response

ZTurboX avatar Jun 06 '22 01:06 ZTurboX

Which solution are you using? What is your data size?

You can log the time spent retrieving in your solution, for example in Milvus or Postgres, maybe you need to create an index in them?

shiyu22 avatar Aug 05 '22 03:08 shiyu22