Skip to content

[Erlang] decrease memory usage#9946

Merged
wing328 merged 2 commits intoOpenAPITools:masterfrom
lixen-wg2:master
Jul 16, 2021
Merged

[Erlang] decrease memory usage#9946
wing328 merged 2 commits intoOpenAPITools:masterfrom
lixen-wg2:master

Conversation

@lixen-wg2
Copy link
Copy Markdown
Contributor

When using the the generated code with many paths we could sometimes end up using 50MB memory per request.
This is since the process will use the complete dispatch rule including one validator state per path.

This removes that and instead we fetch the state after we found the match in cowboy.
This way we will only have seen one jesse ValidatorState
https://github.com/ninenines/cowboy/blob/master/src/cowboy_router.erl#L163

@tsloughter @jfacorro @robertoaloi

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • Run the following to build the project and update samples:
    ./mvnw clean package 
    ./bin/generate-samples.sh
    ./bin/utils/export_docs_generators.sh
    
    Commit all changed files.
    This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
    These must match the expectations made by your contribution.
    You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*.
    For Windows users, please run the script in Git BASH.
  • File the PR against the correct branch: master, 5.3.x, 6.0.x
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

@wing328
Copy link
Copy Markdown
Member

wing328 commented Jul 16, 2021

Tests passed locally:

[INFO] 
[INFO] -----------------< org.openapitools:ErlangServerTests >-----------------
[INFO] Building Erlang Petstore Server 1.0-SNAPSHOT
[INFO] --------------------------------[ pom ]---------------------------------
[INFO] 
[INFO] --- maven-dependency-plugin:2.8:copy-dependencies (default) @ ErlangServerTests ---
[INFO] 
[INFO] --- exec-maven-plugin:1.6.0:exec (compile-test) @ ErlangServerTests ---
===> Verifying dependencies...
===> Analyzing applications...
===> Compiling openapi
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 18.701 s
[INFO] Finished at: 2021-07-16T11:24:08+08:00
[INFO] ------------------------------------------------------------------------

@wing328
Copy link
Copy Markdown
Member

wing328 commented Jul 16, 2021

LGTM but I'm no expert in Erlang.

@wing328 wing328 merged commit 2e030c0 into OpenAPITools:master Jul 16, 2021
@sebastiw sebastiw mentioned this pull request Jul 20, 2021
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants