Похожие чаты

Hey, I'm trying to connect to a MongoDB server with

Spring Boot. I need to execute two commands, saveAll and findById, but only for one collection. I want it to be as fast as possible. Do you know of a good library for this?

10 ответов

33 просмотра

Why not use spring data mongodb?

Lavlii- Автор вопроса
Alireza dHb
Why not use spring data mongodb?

I think it is not for performance

Lavlii
I think it is not for performance

But your saying saveAll and findById, do you mean you want to use repository interfaces or just the operation s?

Lavlii
I think it is not for performance

I think the performance is ok with this library. Do you gave a large collection?

I'll add to what Alireza has mentioned already. It's not just that spring-data-mongodb performance is fine. It's that performance differences of DB clients is negligible compared to the DB performance and network calls. If you care about performance that much, then you should first look at the choice of DB, your data model, indexes, and that indexes fit into ram. That is what will give you 99.9999% of performance, not the choice of the client library. Yeah, client library may make a difference under certain circumstances. But that's usually a result of a different kind of requirements, not what you described. Also, if your collection takes 200Gb (holy sh*!!!!, that's huuuuge), then you need to pay attention to your indexes sizes. If your main call is "findById", then check that index for id field fits into ram. If it doesn't, then DB will have to continuously swap pieces of the index while performing a simple "findById" operation. Which kind of defeats the whole purpose of indexes. And obviously will result in a significant performance degradation, especially with the increasing number of parallel "findById" requests. And another recommendation. If you have 200Gb collection, then most likely you're doing something wrong. Make sure that you learn about data modeling patterns and anti-patterns in mongo (google for something like "mongodb patterns" and "mongodb anti-patterns"). Here's a list of my bookmarks: https://www.mongodb.com/docs/manual/data-modeling/ (check all sub-sections there) https://www.mongodb.com/blog/post/building-with-patterns-a-summary https://www.mongodb.com/developer/products/mongodb/schema-design-anti-pattern-summary/ https://www.mongodb.com/docs/manual/applications/data-models/

Lavlii- Автор вопроса
Dmytro Buryak
I'll add to what Alireza has mentioned already. I...

Hey, thanks. The collection can get up to 200 GB because it keeps info from a week ago. I think it's too much, but it's not up to me. Anyway, I think the action that was slow was saveAll, not findByID.

Lavlii
Hey, thanks. The collection can get up to 200 GB b...

what's the performance of "save 1"? you may need to know the specific size

Lavlii- Автор вопроса
starburst alias
what's the performance of "save 1"? you may need ...

The problem was that I was running locally and not on an environment

Lavlii
The problem was that I was running locally and not...

what's the difference between local and environment? have you thought split data to 2 or more database?

Lavlii- Автор вопроса
starburst alias
what's the difference between local and environmen...

Lock it on my PC environment is on osft and has more resources

Похожие вопросы

Обсуждают сегодня

лучше скажите, причём тут паскаль?
Alexey Kulakov
36
Another way to think about it is like this: let's say we sell $100m of FXB2029 and another $100m of FXB2055 and we buy $200m of ETH with it. Do you think that ETH price will b...
Sam Kazemian ¤⛓️¤
20
Здравствуйте, хочу сделать HelloWorld в консоли Дельфи, но функция API ничего не выводит, что я делаю не так? program Hello; {$APPTYPE CONSOLE} uses System.SysUtils, WinAPI.Wi...
Sergey Vinogradov
20
Ready for some fun AND a chance to win TKO Tokens? Join us for exciting minigames in our Telegram group! 🕒 Don’t miss out—games start on today 25 October 2024, at 8 PM! Ge...
Milkyway | Tokocrypto
255
Нет ничего более бессмысленного, чем рассуждать о нынешней американской политике, пытаясь запихнуть ее в категории "правого" и "левого" старого образца. Ибо эти понятия нынче ...
Foxcool
1
Вопрос на перед, на следующую пятницу. Сколько строк кода можно вешать на одного программиста, понятно что если проект хорошо написан то можно и миллион. Но есть же где то пре...
AlekseyK Kluchnikov
31
Немного оффтопа: а кто на чем сидит для осдева в плане ide/редактора? Последнее время сидел на vscode, но я его прям не могу нормально воспринимать, перешел на сlion, но меня...
Evg Resh
29
#include <stdio.h> #include <stdlib.h> #include <time.h> int** generate_table(int size_matrix) { int** matrix = (int**)malloc(size_matrix * sizeof(int*)); for (int i ...
Чувак
1
Guys I'm working on an infographic and thought I'd crowdsource this a bit. Anyone interested in writing 3 sentences or less about why each of the following cryptos deserve to ...
TMR.ΣRG
10
What will be done for the $UOS price in the short term ? as it is really going to the cave right now…
DioZ
15
Карта сайта