Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mysql db as an alternative to socket programming?

Tags:

c#

mysql

Is it bad practice to use a mysql database running on some remote server as a means of interfacing 2 remote computers? For example having box1 poll on a specific row of the remote db checking for values posted by box2, when box2 posts some value box1 carries out a,b,c. Thanks for any advice.

like image 497
brux Avatar asked Dec 21 '22 15:12

brux


1 Answers

Consider using something like ZeroMQ, which is an easy-to-use abstraction over sockets with bindings for most languages. There is some nice intro documentation as well as many examples of various patterns you can use in your application.

I can understand the temptation of using a database for this, but the idea of continually writing/polling simply to signal between clients wastes IO, ties up connections, etc. and, more importantly, seems like it would difficult to understand/debug by another person (or yourself in two years).

like image 77
Ben Hoffstein Avatar answered Dec 24 '22 05:12

Ben Hoffstein