Azure-Samples / azure-search-openai-demo

A sample app for the Retrieval-Augmented Generation pattern running in Azure, using Azure AI Search for retrieval and Azure OpenAI large language models to power ChatGPT-style and Q&A experiences.
https://azure.microsoft.com/products/search
MIT License
6.01k stars 4.12k forks source link

Reduce Costs by Minimizing Service Usage or Deactivation When Not Needed or in Idle #2022

Open YIN-Renlong opened 1 week ago

YIN-Renlong commented 1 week ago

Please provide us with the following information:

This issue is for a: (mark with an x)

- [ ] bug report -> please search issues before submitting
- [x] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

  1. Deploy the azure-search-openai-demo app on Azure.
  2. Keep the app running 24/7, observe the consumption costs.

Any log messages given by the failure

None

Expected/desired behavior

I have noticed that running the app 24 hours a day incurs a daily cost of around $30, with the most significant cost coming from "Azure Cognitive Search." I would like to have an option to reduce the consumption costs by:

  1. Automatically pausing or shutting down services when not in use.
  2. Minimizing resource usage when the app is idle.
  3. Any alternative suggestions to lower costs while keeping the app functional on-demand.

OS and Version?

macOS (Ventura)

azd version?

azd version 1.9.5

Versions

Python 3.10, Node.js 18

Mention any other details that might be useful

Currently, the daily cost of running the app 24 hours a day is approximately $30, primarily due to Azure Cognitive Search. I am looking for ways to reduce this, especially when the app is not actively being used. Are there any options for configuring services like Azure AI Search or Azure OpenAI to minimize resource consumption when idle or to activate only when needed?


Thanks! We'll be in touch soon.

bnodir commented 6 days ago

How about deploying with minimal costs(Use the free tier of Azure AI Search). Have you considered trying that?

YIN-Renlong commented 5 days ago

How about deploying with minimal costs(Use the free tier of Azure AI Search). Have you considered trying that?

@bnodir Thank you for your suggestion! While I’m happy to pay for the services I use (as the free tier’s limits and performance don’t meet my needs), my main concern is the cost incurred when the service is idle, such as during nights and weekends. My original question was about finding a way to avoid these idle-time costs—for example, by automatically shutting down or minimizing the service during these periods, and then re-enabling it within 10-20 minutes when needed.

Deleting and redeploying resources isn’t practical in my case, as I manage a large volume of documents. The redeployment process would take significant time and add further costs due to the digest process.

Do you have any suggestions that could address this issue?

bnodir commented 2 days ago

@YIN-Renlong - For the digest process, I recommend using local PDF/CSV parsers if your documents are in those formats. However, I agree that redeployment is not the best option due to the time it consumes.

YIN-Renlong commented 2 days ago

@bnodir Thanks for the suggestions. I would be more than willing to explore the option of deploying the app locally and utilizing the API only when necessary. However, I am concerned about whether this approach might impact performance, especially during more demanding tasks.

I am very interested in a solution that focuses on local deployment as much as possible, as there are many scenarios where continuous online deployment isn't required. Minimizing the usage of cloud resources could significantly help reduce costs. However, from what I can see, this project doesn't seem to have a branch or pathway that fully supports local deployment yet, right? I would really appreciate hearing more of your thoughts or recommendations on this approach. Looking forward to your insights.

cforce commented 2 days ago

Is there a feature comparison between localpdf parser and Azure Document Intelligence? What shall a at all not always use the local pdf parser? Especially how about image got vision recognition with or without vision in this context?