Whether to use Mongo?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
38 views
Welcome!

In recent years, increasingly hear mention about NoSQL and MongoDB in particular. The topic interested me, but can't find my information, so I ask here — surely many have time to experiment, and may develop serious high-load applications in conjunction with MongoDB.
Warns you in advance if somewhere I was wrong in relation to MongoDB — I didn't mean to. Just I haven't even tried to work, but only read articles on Habre, but those examples that lie at the office.website.

I am designing the network teaser. The task, at first glance, seemingly trivial, in fact it is quite microvillae in terms of organization of structure of a DB. A huge number of relations, multiple tables intermediaries for relationships M-M, etc... Than I was attracted to the idea of MongoDB is its principle of building relationships. Question No. 1:
whether working with Mongod with a bunch of ties is less costly in terms of resources? Well, at least the simplest example (I will write in "pseudo SQL") — sampling from 2 tables linked by relation M-M through the intermediate table:
table sites(
id int primary key auto_increment,
url varchar
)

table categories(
id int primary key auto_increment,
name varchar
)

table sites_categories(
site_id int,
category_id int
)

Task display a list of sites and categories in which it is:

SELECT * FROM sites

while(SITE = mysql_result...)
{
//display website
SELECT * FROM categories WHERE id IN (SELECT category_id FROM sites_categories WHERE site_id = SITE)
//in a loop display category
}

Also, I'm interested, is it possible to work simultaneously with MySQL and MongoDB? I mean, how is that right? To switch your DB to Mongo did not want to, only a few specially-cunning plots, the load of which is higher than desirable.

Also read that MongoDB can easily store files — is this so and what would be better to keep the old-fashioned way in a special folder with subdirectories for the names/user IDs, or use MongoDB? (let's say in this scenario: users about 1K, each 40-50 small pictures. pictures are given in a quantity of approximately 100-150 / min.

PS: I apologize for possible inaccuracies in the questions, redundant or untold information about the needs and current situation, development of database schema — not my main advantage...
by | 38 views

6 Answers

0 like 0 dislike
Sorry for offtopic, but in your examples like
\rSELECT * FROM categories WHERE id IN (SELECT category_id FROM sites_categories WHERE site_id = SITE)
JOIN fundamentally not being used???
\r
And the pictures try on Amazon store
by
0 like 0 dislike
Be careful! Principles of construction of the database in Mongo other. You need to understand how it stores objects, and that loads the entire object.
by
0 like 0 dislike
Actually, IMHO, the many-to-many is not strong Mongo (and other NoSQL DB that I know). The most effectively they are working with an embedded object, that is relationships one-to-one unilateral and one-to-many.
by
0 like 0 dislike
Mongo for each site should include the category_id is listing the categories. That is, nosql for the relationship is many-to-many is implemented by storing in one of the objects of enumeration relationship to the second.
by
0 like 0 dislike
For starters, check out document www.mongodb.org/pages/viewpage.action?pageId=5079114
\r
Here is an example of how this might look
\rpastie.org/1226804
\r
And the request for example to get all the teasers for Moscow where there were clicks, for example more than 10
\rpastie.org/1226857
\r
Regarding reliability and speed, honestly I haven't experimented globally, then you have to independently perform research, one can say, speed of implementation and expansion good :)
by
0 like 0 dislike
Again offtopic:
Actually, I have modified teaser network... There is no one targeting but normally practiced about 90 million impressions teasers a day (now momentum slept until about 50 million). It all turns on a single relatively powerful server (and the second server — only pictures).
There all the data about the teasers, banned IPS, the price per impression/click climb from memcache. If memcache any data, there is no reason (such as Eviction or cold start), only then is extracted from the DB and placed immediately back into Menkes. Statistics for the last minute also placed in Menkes and once a minute the data is collected, computed and summary statistics are placed in MySQL. Ie in fact for untwisting the teasers of the database in General is not touched.
(To memcache generally used file system for these data was flying almost as well as on memcache)
\r
But you might not like it cause they don't know really where targeting is implemented.
by

Related questions

0 like 0 dislike
2 answers
0 like 0 dislike
7 answers
0 like 0 dislike
4 answers
0 like 0 dislike
1 answer
110,608 questions
257,186 answers
0 comments
26,177 users