Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use global persistence connection to enhance performance #79

Open
s8sg opened this issue Jul 28, 2019 · 0 comments
Open

Use global persistence connection to enhance performance #79

s8sg opened this issue Jul 28, 2019 · 0 comments
Assignees
Labels
enhancement New feature or request faas-flow-template Issue applies to component: fass-flow-template

Comments

@s8sg
Copy link
Owner

s8sg commented Jul 28, 2019

All call to function and for next node execution are submitted via Gateway. In the current code

  • A http client was being created for each incoming message in the handler. this is a overkill, cause for every new request there will be a Handshake.
  • The http client created was using default transport. default http client does have a keep-alive setting.

We can reuse a connection instead of creating new one. We can do so by creating a global client as:

var client *http.Client

func init() {
    tr := &http.Transport{
           MaxIdleConnsPerHost: 1024,
     }
   client = &http.Client{Transport: tr }
}

When we are using common client, we also need to make sure that we

  • Read until Response is complete (i.e. ioutil.ReadAll(rep.Body))
  • Call Body.Close()
@s8sg s8sg added the enhancement New feature or request label Jul 28, 2019
@s8sg s8sg added the faas-flow-template Issue applies to component: fass-flow-template label Aug 7, 2019
@s8sg s8sg self-assigned this May 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request faas-flow-template Issue applies to component: fass-flow-template
Projects
None yet
Development

No branches or pull requests

1 participant