Closed Bug 657805 Opened 13 years ago Closed 13 years ago

Marks are too big to be handled efficiently by the database

Categories

(Websites Graveyard :: markup.mozilla.org, defect)

defect
Not set
blocker

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: wenzel, Assigned: brez)

References

Details

Attachments

(2 files)

When fixing a problem with a race condition on saving marks, we load-tested the submission and noticed that with 10 concurrent users, dev and stage take between 4 and 20 seconds to save a mark.

About 25% of these submissions fail when the transaction runs into a timeout, because previous submissions are still running.

We believe that this is caused by single marks being between 50 and 150 kilobytes large (base64-encoded).

With the current state of the database (2000 marks), we are using an average of 100KB per mark.


This leads to two problems:
- depending on the success of the project, our database server will inevitably run out of disk space (about 200GB).
- more importantly, MySQL seems unable and not designed to handle such massive amounts of data efficiently.

What do we do? Marks can be stored on the file system, but that touches many parts of the app, so this fix would become quite large. Any other possibilities? Not Base64-encoding the data in the database and instead making the field a BLOB would reduce the size a little, but the marks are still too complex and would still take many kilobytes. Any way to reduce their size to, say, 5KB a piece?
Attached file JMeter test file
This is the jmeter test file we've been using. For it to work, put the right password into the Auth manager (or change the settings to point at your own server).
Target Milestone: --- → 1.0
Depends on: 657823
Since we can't rearchitect the entire app, will try to reduce the weight of individual submissions. Can we get rid of points_obj and just keep points_obj_simplified around?
Assignee: nobody → fwenzel
We should get individual marks down to 20K or less in the database.
Assignee: fwenzel → jbresnik
I just ran that jmeter test locally and it passed (with 20 simultaneous requests)  bumped it to a hundred and managed to get some 500s - tracking down exactly what they are..
Wenzel are you working on this or am I?  Some clarification is needed.
Assigning back to you..
Assignee: jbresnik → fwenzel
Assignee: fwenzel → jbresnik
Just a note from QA. The current JMeter script attached (attachment JMeter test file) to this bug is very simple. A single pen stroke. 

Here's a more complex signature of an elephant :)
Just documenting what we're doing for this:

-- Not store raw points in db, but store on a configurable file path using the reference as a file name.  
-- Change the method where if comes out of the backend to look at the file and not the db as well. 
-- Remove base64 encoding from simplified points object.
(In reply to comment #8)
> -- Change the method where if comes out of the backend to look at the file
> and not the db as well. 

I thought the app never uses the raw (unsimplified) data by itself?
Fred, brez, I thought the https://markup.allizom.org/en-US/gml/Ru4M/ was using the raw data, but I could be wrong.
No - gml is created from simplified - raw is being saved only for posterity at the moment
Updated

-- Not store raw points in db, but store on a configurable file path using the reference as a file name.  
-- Remove base64 encoding from simplified points object
What should do re. the encode marks currently in the database?  seems like we need take each one out and decode and put back in.. ?   as part of a migration presumably
Yes, can South migrations do something as complex as that? Just make sure it works before committing, so the dev server doesn't hose its DB ;)
Yea we can do this with south - will test locally of course..
All set

https://github.com/mozilla/markup/commit/28ef93a6ebec565858489f8771343d642c21aa97

Note there is a new parameter in settings.py:

https://github.com/mozilla/markup/commit/7d2484a2b28cfec49f3e9b125cd7dcd9ccf30a14
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
wenzel:  Can we bump this to verified given that marks are being saved properly to the db, rendered in the ui, and the gml is exportable?
Yes. If there's anything else that needs fixed in this context, we should open a new bug.
Status: RESOLVED → VERIFIED
Thx Fred :) QA verified as well.
Product: Websites → Websites Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: