Похожие чаты

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

41 просмотр

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

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

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

Господа, а что сейчас вообще с рынком труда на делфи происходит? Какова ситуация?
Rꙮman Yankꙮvsky
29
А вообще, что может смущать в самой Julia - бы сказал, что нет единого стандартного подхода по многим моментам, поэтому многое выглядит как "хаки" и произвол. Короче говоря, с...
Viktor G.
2
@Benzenoid can you tell me the easiest, and safest way to bu.y HEX now?
Živa Žena
20
This is a question from my wife who make a fortune with memes 😂😂 About the Migration and Tokens: 1. How will the old tokens be migrated to the new $LGCYX network? What is th...
🍿 °anton°
2
30500 за редактор? )
Владимир
47
а через ESC-код ?
Alexey Kulakov
29
What is the Dex situation? Agora team started with the Pnetwork for their dex which helped them both with integration. It’s completed but as you can see from the Pnetwork ann...
Ben
1
Гайс, вопрос для разносторонее развитых: читаю стрим с юарта, нада выделять с него фреймы с определенной структурой, если ли чо готовое, или долбаться с ринг буффером? нада у...
Vitaly
9
Anyone knows where there are some instructions or discort about failed bridge transactions ?
Jochem
21
@lozuk how do I get my phex copies of my ehex from a atomic wallet, to move to my rabby?
Justfrontin 👀
11
Карта сайта