<i id='ckfim'><tr id='ckfim'><dt id='ckfim'><q id='ckfim'><span id='ckfim'><b id='ckfim'><form id='ckfim'><ins id='ckfim'></ins><ul id='ckfim'></ul><sub id='ckfim'></sub></form><legend id='ckfim'></legend><bdo id='ckfim'><pre id='ckfim'><center id='ckfim'></center></pre></bdo></b><th id='ckfim'></th></span></q></dt></tr></i><div id='ckfim'><tfoot id='ckfim'></tfoot><dl id='ckfim'><fieldset id='ckfim'></fieldset></dl></div>

      • <bdo id='ckfim'></bdo><ul id='ckfim'></ul>

      <tfoot id='ckfim'></tfoot>

      <small id='ckfim'></small><noframes id='ckfim'>

        <legend id='ckfim'><style id='ckfim'><dir id='ckfim'><q id='ckfim'></q></dir></style></legend>

      1. Azure Functions 中的 HttpClient 最佳实践

        HttpClient best practices in Azure Functions(Azure Functions 中的 HttpClient 最佳实践)

            • <bdo id='iYdgc'></bdo><ul id='iYdgc'></ul>

              1. <i id='iYdgc'><tr id='iYdgc'><dt id='iYdgc'><q id='iYdgc'><span id='iYdgc'><b id='iYdgc'><form id='iYdgc'><ins id='iYdgc'></ins><ul id='iYdgc'></ul><sub id='iYdgc'></sub></form><legend id='iYdgc'></legend><bdo id='iYdgc'><pre id='iYdgc'><center id='iYdgc'></center></pre></bdo></b><th id='iYdgc'></th></span></q></dt></tr></i><div id='iYdgc'><tfoot id='iYdgc'></tfoot><dl id='iYdgc'><fieldset id='iYdgc'></fieldset></dl></div>
                  <tbody id='iYdgc'></tbody>

                <small id='iYdgc'></small><noframes id='iYdgc'>

                <tfoot id='iYdgc'></tfoot>
              2. <legend id='iYdgc'><style id='iYdgc'><dir id='iYdgc'><q id='iYdgc'></q></dir></style></legend>

                  本文介绍了Azure Functions 中的 HttpClient 最佳实践的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我需要构建一个 Azure 函数:

                  I need to build an Azure Function that:

                  • 响应 HTTP POST 请求
                  • 根据数据执行 7 次 HTTP HEAD 请求.
                  • Responds to a HTTP POST request
                  • Does 7x HTTP HEAD requests based on the data.

                  我在这里和这里

                  但是,不完全清楚该做什么以及它是如何工作的?

                  But, it's not entirely clear what to do, and how it works?

                  与第二个链接一样,我目前刚刚声明了一个 private static HttpClient httpClient = new HttpClient(); 实例,并在我的 7x HTTP HEAD 调用中重新使用了它.

                  As in the second link, i've currently just declared a private static HttpClient httpClient = new HttpClient(); instance, and re-used that in my 7x HTTP HEAD calls.

                  我的问题:

                  1. 这是在无状态 Azure 函数中最有效地使用 HttpClient 吗?
                  2. 我目前正在为 http 调用构建一个 List(),然后对它们执行 Task.WhenAll(tasks) 以在其中运行它们平行.这会是打这些电话的最快方法吗?还有其他建议吗?
                  1. Is that the most efficient use of HttpClient in a stateless Azure function?
                  2. I'm currently just building up a List<Task>() for the http calls, then doing Task.WhenAll(tasks) on them to run them in parrallel. Would that be the quickest way to do these calls? Any other suggestions?

                  这个 Function 端点会被大量调用(每秒多次),因此需要尽可能高效以降低成本.

                  This Function endpoint will be called a lot (multiple times a second), so need to be as efficient as possible to keep costs down.

                  谢谢!

                  推荐答案

                  是的 - 这仍然是 Azure Functions 1.x(也适用于 2.x)的当前指南,以最好地避免套接字耗尽.静态变量将确保它将与类的所有实例共享.涵盖此主题的另一篇好文章是 https://aspnetmonsters.com/2016/08/2016-08-27-httpclient错误

                  Yes - this is still the current guidance for Azure Functions 1.x (and applies to 2.x as well) to best avoid socket exhaustion. The static variable will ensures that it will be shared against all instances of the class. Another good article that covers this topic is https://aspnetmonsters.com/2016/08/2016-08-27-httpclientwrong

                  这篇关于Azure Functions 中的 HttpClient 最佳实践的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Adding and removing users from Active Directory groups in .NET(在 .NET 中的 Active Directory 组中添加和删除用户)
                  set equality in linq(在 linq 中设置相等)
                  HashSet conversion to List(HashSet 转换为 List)
                  How to set timeout for webBrowser navigate event(如何为 webBrowser 导航事件设置超时)
                  Test whether two IEnumerablelt;Tgt; have the same values with the same frequencies(测试两个IEnumerablelt;Tgt;具有相同频率的相同值)
                  How do you determine if two HashSets are equal (by value, not by reference)?(您如何确定两个 HashSet 是否相等(按值,而不是按引用)?)

                  <small id='YaMMY'></small><noframes id='YaMMY'>

                  <i id='YaMMY'><tr id='YaMMY'><dt id='YaMMY'><q id='YaMMY'><span id='YaMMY'><b id='YaMMY'><form id='YaMMY'><ins id='YaMMY'></ins><ul id='YaMMY'></ul><sub id='YaMMY'></sub></form><legend id='YaMMY'></legend><bdo id='YaMMY'><pre id='YaMMY'><center id='YaMMY'></center></pre></bdo></b><th id='YaMMY'></th></span></q></dt></tr></i><div id='YaMMY'><tfoot id='YaMMY'></tfoot><dl id='YaMMY'><fieldset id='YaMMY'></fieldset></dl></div>

                    • <legend id='YaMMY'><style id='YaMMY'><dir id='YaMMY'><q id='YaMMY'></q></dir></style></legend>

                      <tfoot id='YaMMY'></tfoot>

                          <tbody id='YaMMY'></tbody>

                          <bdo id='YaMMY'></bdo><ul id='YaMMY'></ul>