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

[Feature] Optimize /content add endpoints #98

Open
jcace opened this issue Jul 17, 2023 · 1 comment · May be fixed by #103
Open

[Feature] Optimize /content add endpoints #98

jcace opened this issue Jul 17, 2023 · 1 comment · May be fixed by #103
Assignees

Comments

@jcace
Copy link
Contributor

jcace commented Jul 17, 2023

  • Calling POST /api/v1/datasets/contents/ (i.e, from edge-vertex) takes longer depending on how many contents are being published. In my testing, I saw it take several seconds with only ~20 contents to be added
  • Additionally, importing from singularity where we had 8000+ contents took a solid 5+ minutes
  • We need to optimize the db insert queries to speed it up - this should be a very fast operation. Currently it does each one individually to keep track of success/fail, so would be good to investigate if we can somehow batch them together for one db transaction instead
@jcace
Copy link
Contributor Author

jcace commented Jul 18, 2023

Some things we could do:

  1. When matching up the collection names with the datasets, make a single query i.e select * from datasets; instead of a separate query for each unique collection name.
  2. Put all of the db.Create() operations in a transaction https://gorm.io/docs/transactions.html , so they all execute at once

@LucRoy LucRoy self-assigned this Jul 18, 2023
@LucRoy LucRoy linked a pull request Jul 24, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants