0

im fetching simultaneous data from some api using nodejs. my database is mysql.

INSERT into mysql(tabels) values (values)

enter image description here

the problem is sometimes the api doesnt run nor stop maybe becouse a timeout error(sometimes) or something;

  1. what happens if the we query insert at the same time?

  2. how do you insert hundreds of data async simultaneously from many source?

  3. how do you do it? is there any database like mangodb or anything maybe already built for something like this?

4
  • 1
    I don't think that anybody here will be able to check your logs for you, you will have to read the logs to check what problems are reported. On more general note: 1) nearly nothing in computing happens simultaneously, most of the time the requests are queued and processed sequentially. 2) even on multi-core multi-threaded systems low level operations are queued most of the time. 3) most database engines are capable of processing millions of transactions per second (is that simultaneous enough for you?) Commented Oct 24, 2012 at 14:24
  • There are many DB engine settings that you may have to change to process/queue more transactions per second. You will need to check DB engine docs for that Commented Oct 24, 2012 at 14:25
  • @GermannArlington from the node error log or mysql logs? where can we see them? Commented Oct 24, 2012 at 14:40
  • 1
    It may be either, depending on the errors. If the connections are dropped due to not enough threads on MySQL server than you are likely to find errors in node.js logs. On the other hand if the insert transaction is initiated but abandoned in the process you are more likely to find reasons in MySQL logs. Commented Oct 24, 2012 at 14:45

1 Answer 1

1

MySQL, like any other tool, works well when used correctly. There's nothing about a large number of asynchronous writes that is inherently problematic, but in your case you will need to benchmark and simulate your expected load to find out for sure.

Generally inserting two or more things at the same time is not an issue. You can always tune your database to respond more quickly by designing your tables to be easy to update, keeping indexes to a minimum, eliminating unnecessary columns, and operating on a fast disk.

Keep in mind that inserting the data isn't usually the problem. It's making use of the data once it's inserted. You haven't really described what your intention is here.

There's no specific reason to use a NoSQL tool here, even if you're doing 10K inserts per second, which a properly tuned and architected MySQL can handle.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.