Похожие чаты

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 ответов

35 просмотров

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

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

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

30500 за редактор? )
Владимир
47
any reference of this implementation?
BitBuddha
29
Ⓐrtto, [4/23/24 7:02 PM] Please explain more fully how it is not working exactly, and what are the steps you are taking, and what error messages come or what happens. Ⓐrtto, ...
Ezza Kezza
2
sounds like people have lost their kaspa on tradeogre... does this mean tradeogre not trustworthy?
Ezza Kezza
15
Страшнейшая правда про списки ЦБ. С первых дней жизни P2P сферы, молодые человеки, начитавшись законодательной базы и "внутренних" документов, решили, что им противостоит сер...
Foxcool
3
Недавно Google Project Zero нашёл багу в SQLite с помощью LLM, о чём достаточно было шумно в определённых интернетах, которые сопровождались рассказами, что скоро всех "ибешни...
Alex Sherbakov
5
So much speculation in the last week. So much volatility in price. This is because Hedera has a GC that isn't using the network it's governing. Why aren't people asking why a...
Summit Seeker R
8
Anyone else having this error when trying to make transactions?
Datzel
11
Question: How viable is it to use Anvil as the backend infrastructure for managing a TradFi portfolio, while integrating Flexa for instant liquidity and payment solutions? Cou...
Kevin
2
вы делали что-то подобное и как? может есть либы готовые? увидел картинку нокода, где всё линиями соединено и стало интересно попробовать то же в ddl на lua сделать. решил с ч...
Victor
8
Карта сайта