Похожие чаты

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

7 просмотров

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

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

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

Hello Everyone 🙌🏻💜 Happy (?) Friday to everyone 😁😁 I have read through all the comments/feedback/complaints in the last 2 days following the CEO Update AMA. Clearly the ...
Patrick - Ultra.io
4
How did we have so many dormant scammers in here? Who are these people. It’s been years. We know each other. If you dm me “I’ve been an og” but haven’t said a single word her...
Justin | LGCY |
42
Кстати, а я вот тут подумал. Допустим, у нас имеется цикл который выполняет огромное количество итераций, но мы хотим, чтобы какие-то действия исполнилось только один раз. В Я...
The Bird of Hermes
23
Доброй ночи. Вопрос знатокам. Имеется некая таблица, результат которой выведен в DBGrid на форме. И есть форма, с помощью которой можно как добавить запись, так и отредактиров...
Евгений
28
🌟 Great News from Dypius! 🌟 We're happy to announce the Early Access launch of the Dypius Mobile App by the end of this month! Let's dive into the features you'll get to exp...
DYP | Tim
3
Guys I want to exec into a container running on Fargate like this: aws ecs execute-command --cluster my-cluster --task task_id --container app --command bash --interactive ...
Ehsan
14
а всё почему? потому что ассемблер в отличии от яву порождает множество пагубных привычек, среди которых например можно отметить использование глобальных переменных для всего ...
Mixail Frolov
35
Dan continues to show up to AMA's, supports and speaks about ergo, hired two ergo devs to be part of the team, developed open source software that anyone can use on ergo, offe...
qx()
24
Всем привет 👋 Подскажите пожалуйста, а чего тут не хватает permission или образ битый? Running with gitlab-runner 17.0.0 (44feccdf) on gitlab-runner-c58775949-d7znz YxYz2zp...
Max
2
анрей С какой целью зашёл?
КТ315
42
Карта сайта