M
M
MrOnatsky2018-07-12 05:01:36
SQLite
MrOnatsky, 2018-07-12 05:01:36

SQLite for chats?

Good day. Tell me, is SQLite suitable for chat? To connect MySQL server for this, oh, how not hunting. For each user, a database file is created, and it already contains all the correspondence. Yes, there is no multithreading, but very rarely there will be simultaneous requests (only 2 people, well, or a little more). And even if they are, writing / reading is very fast, and the queue is still faster than MySQL. Or are there some hard pitfalls? Yes, it's easier to stuff everything in MySQL, but the table with messages will very often twitch, reading, and writing, and checking for new messages, and updating the status viewed / read. Moreover, there are no locks when reading, and there can be several threads. So the user logged in, the chat was updated, only his table was affected, and left. It seems to me that it will be more convenient to work with the file. Yes, those are chats. There may be a lot of messages. And if in the general table (base) to do everything, then there will be an number of records. So from what do you think about this? And does SQLite natively run in queue mode? Or if there was a connection to the database at the time, will it give an error, or just wait? That's interesting. If not, how can I set this up?
By the way, about the creation of these chats. It already in the separate general table everything will be done. And here already multithreading was needed. But, I also decided to use SQLite, and shove the updated result (the list of user chats) in Redis for each user. Appeals will be only when the chat will be created and deleted. That is, not strongly loaded table. If there is already a queue, then it’s not very big, you can wait a second more (although this is strongly taken, I think somewhere there won’t even be a quarter).
From deal with this queue, and beauty. Help) Thank you in advance!

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question