Do database client libraries use HTTP to talk to the database servers? - database

In general - If I use a library in my programming language (NodeJS, C#, Java, etc) to communicate with a database (or similar performance sensitive client/server relationship - PSQL, MSQL, Redis, RabbitMQ), how does the client library usually talk to the server application?
Is it just an HTTP API? Do they have some kind of custom protocol over TCP?

Related

how to create chat(websocket) server on google cloud platform

I already working on AppEngine which is my android backend but I have to create chat system for my app so I cannot figure out how to do that.
I'm using spring boot
please help. sorry for any kind of mistake.
You can use google compute engine on google cloud to write down your WebSocket server.
Also, you can use apache thrift for a seamless design of communication protocol between different language. It saves lots of repeated effort while designing communication protocol.
From Quora
There's a lot of repeated work you have to do when you're writing a server - primarily designing a protocol and writing code to serialize and deserialize messages on the protocol, but also dealing with sockets and managing concurrency, and writing clients in many languages. Thrift automatically does all of this, given a description of the functions you want to expose from your server to clients. It's also useful for serializing data on disk or into shared memory (where many of the same problems come up).

To what extent is Couchbase a drop in replacement for Memcached

Official couchbase documentation says.
"If you already have an application that uses the Memcached protocol
then you can start using your Couchbase Server immediately. If so, you
can simply point your application to this server like you would any
other memcached server. No code changes or special libraries are
needed, and the application will behave exactly as it would against a
standard memcached server. Without the client knowing anything about
it, the data is being replicated, persisted, and the cluster can be
expanded or contracted completely transparently."
We already have a C based application which was working with memcached by using libmemcached C APIs.
We wanted to move to couchbase since we wanted persistence (mainly).
We saw the aforementioned Couchbase quote and tried this (with Couchbase bucket) and it was a pleasant surprise. It worked , just like that. +1 for that.
We found that there also exists a Couchbase C api, Now following are the questions,
If libmemcached API is enough to use Couchbase, what does the Couchbase C API offer ?
What are the disadvantages of ( continuing ) to use (existing ) libmemached API to talk to Couchbase type bucket of Couchbase server ?
What are the advantages of upgrading our application to use Couchbase C api to talk to Couchbase server ?
1) If libmemcached API is enough to use Couchbase, what does the
Couchbase C API offer ?
Of course couchbase extends memcached protocol with new operations, like touch, observe, get with lock, unlock, read from replica etc. Some of them although can be implemented in libmemcached (I've done patch for touch command a while ago), not supported by the vanilla memcached server, therefore it will be harder to test and maintain in libmemcached. Other commands like observe, read from replica, cannot be implemented in terms of libmemcached at all. Another group of APIs of Couchbase is view queries to database indexes, which built with map/reduce, libcouchbase is able to do it.
2) What are the disadvantages of ( continuing ) to use (existing )
libmemached API to talk to Couchbase type bucket of Couchbase server ?
Libmemcached, like any other memcached client you can find, considered as "dumb" or "legacy" client, as opposed to "smart" clients. The difference is whether or not the client aware of cluster topology. Legacy clients have to go through single entry point in the cluster or do some kind of balancing (like round-robin). And by default it will use server-side proxy for that, which aware of topology and can re-route in case that this node doesn't own the key. Therefore you will likely hit the limit of this proxy, when network/CPU/memory capacity actually enough to serve requests (although it is possible to setup this proxy on client side). The smart clients aware of the cluster topology and follow its change, so that it can eliminate re-routing of the keys.
3) What are the advantages of upgrading our application to use
Couchbase C api to talk to Couchbase server ?
You will be able to access other APIs and extended API of memcached. Also Couchbase clients can optimize network usage.

Application backend and networking?

I'm not sure if the title I used is good, but hopefully my question will be better.
I have an java application that tracks data on PennyAuction sites(such as beezid.com), and will eventually upload all of the data to a database. Clients will download a java application and run it on their local machine, but this local machine application will have to be able to access the database and obtain all of the data.
All I have ever done is java applications programming, so this is all very new to me. Can anybody help me with a solution that will be able to accomplish this?
This is all I can think of:
Server that will run Backend application 24/7, and use JDBC to upload data to database.
Separate server for database alone.
I have no idea how the client application should connect to the database though.
Any help/links to tutorials on stuff like this would be appreciated.
You could actually let your clients connect to the database directly if the database is on a public IP.
An architecurally much better way of doing this is with webservices. This would make your system much more safe, robust and scalable.
Web services are client and server applications that communicate over the World Wide Web’s (WWW) HyperText Transfer Protocol (HTTP). As described by the World Wide Web Consortium (W3C), web services provide a standard means of interoperating between software applications running on a variety of platforms and frameworks. Web services are characterized by their great interoperability and extensibility, as well as their machine-processable descriptions, thanks to the use of XML. Web services can be combined in a loosely coupled way to achieve complex operations. Programs providing simple services can interact with each other to deliver sophisticated added-value services.

Distributed application architecture

We are building an application that will have clients installed in many sites. Each client work on its own, has its own database and workflows. However, each client has to submit some data to the main application installed at a central position. The application at a central location must receive updates (e.g stock levels) from the distributed units. All applications are done in Java. Which is the best way/technology of sending the updates from the distributed units to the central application? JMS, jdbc, ...?
I'm going to assume that the servers at client sites have network access, and that you are able to configure the central server so that other clients can connect to it. This could either be over the internet or an internal WAN.
In this case, it's simply a case of finding a mechanism to submit some correctly formatted data, which is received and handled by the central server. This gives you a large number of options, I'm going to list just a few:
Create a web service with something like Apache Axis
Use an ESB - something like Mule or JBoss
Use a simple web Servlet on the server, and submit data using HTTP POST. You could use a simple embeddable Java web server like Jetty to do this.
Use a messaging protocol like Kryonet or Google's protocol buffers
Use a more general network application framework such as Netty
All of these will work, so it really depends on working out which is the best fit for your architecture. I suspect the simplest would be something like Kryonet, the most comprehensive would probably be something like a full JBoss ESB/application server stack.

Communication among clients in Delphi 2009

I wanna build a Win32 app of Client/Server (or 3-tier) type with follow features:
When the "A" client does a modification (update,insert, etc) into a database, the rest of clients viewing the same record set can get almost "instantly" a fresh view of this data
a client can be notified when a connection to database get lost
could someone help me? Thanks in advance
Pdta: My Database is MySQL 5.1
Note that by doing this, and having lots of clients, you will potentially get a lot of network traffic.
This is exactly the reason that most client-server applications do not do this.
If you really want to do this, then the proper was is to implement the 'observer pattern'; a basic example on that design pattern in Delphi has been described by Joanna Carter in her blog.
Then you need to extend that pattern so it works over a network.
So at least you need some server process that handles the "subject" interface.
You can use anything for that: WebServices, DataSnap servers, RemObjects SDK, etc.
Most people wanting a solution like this, go from the traditional client/server application into a multi-tier application. Then the middle-tier can handle all the notifications for you.
My answer depends on your network architecture but I tend to use IP for this type of thing. Something like Multicast is an ideal way to notify all clients on the Network of an event. Simply multi-casting or broadcasting (UDP) the ID of the updated record may be all that is required. If another client is interested in the record, it can then refresh it from the Database.
The Indy Multicast Client/Server components will provide a simply way to implement this in your app.
If you have a three tier type application, the client communicates with the aplication server. This connection could use callbacks to the clients to notify them about important events. DataSnap supports callbacks (afaik also data change notifications).
If you build your own application server. the client could open a socket connection to the server (in a thread) and listen for event notifications. The Indy Telnet client example in Protocols/IdTelnet.pas is a good starting point to create a very simple notification implementation. It uses the TIdTelnetReadThread class to listen for the server responses to key input and protocol negotiations.
If your application needs to run in Terminal Server environments, where Ports will not be virtualized AFAIK, it is safer to connect from the client to the server (instead of opening client socket ports for peer-to-peer communication).
If MySQL doesnt support somekind of pushing info or attatching clients you would need to use a middle tier running on a server.
That server keeps track of connected clients. But it would probably be a heck of a job.
I know that the "bigger" edititions of Delphi has somekind of support of building this kind of client/server software.
I know it has nothing to do with your application, but Firebird has a nice feature to do exactly this. You can read more about them here (link to a PDF).
Now, if you need to do this with MySQL and Delphi, the easiest way I can think of is doing something "AJAX LIKE" on your Win32 app. That is having a server side app (you could use a WebServer with PHP, Java, .NET or whatever you want) that will serve your requests asking for data updates. On the server side app, just do a query asking for modifications into your MySQL Database.
Hope it helps.

Resources