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.
Related
Context
I'm developing a hybrid/mobile app using Cordova. This app displays content, such as news, magazine articles and weather info that is dynamically generated and delivered via a Web App (self-hosted developed with PHP). In order to decide which mobile devices "get" which content, I need to constantly keep track of the history of displays on each device, and gather information such as : article name, display date/time, location(lat/lon), etc.
The BIG problem I have is...
Now, because the data that I'm gathering is unstructured, I first tried with Firebase (Google), which allowed me to easily gather all the data, in real-time using a key:value schema and then retrieve my data on the webapp running another JS script. The problems with this solution are:
Querying possibilities are too limited.
I'm not comfortable leaving all my data handled by Google (Nothing against Google, butI'd prefer to own my data).
The Question
What are the storage strategies that I could use ? I've been reading a lot about Redis, Parse-server, PouchDB+CouchDB, and MongoDB, but I got lost in a world of information about NoSql databases, and now I really do not know what to do :'(
I've always used relational databases for my projects (Mysql, MariaDB), but I'm not afraid in getting my hands dirty with NoSQL databases, however I'd appreciate if anyone can point me to the easiest-to-implement solution.
EDIT (17/04/18)
I think I narrowed down my question to 2 options
PouchDB + CouchDB, or
Couchbase Mobile = Couchbase Lite + Sync Gateway
Can anyone, please give me some feedback with regards to these two options? Ease of implementation, Querying, maintenance, etc ?
Thanks!
Figured, I should probably explain my earlier comment better.
Couchbase Mobile = Couchbase Lite (runs on mobile device) + Sync Gateway + Couchbase Server (hosted in backend)
W.r.t your first concern
Querying possibilities are too limited.
Couchbase Server supports N1QL - which is a superset of SQL for NoSQL. So you should be able to do the kind of extensive querying that you want w/ Couchbase Server.This link discusses how you can do geospatial queries (since you mentioned that as a use case)
W.r.t your second concern
I'm not comfortable leaving all my data handled by Google (Nothing
against Google, butI'd prefer to own my data).
With Couchbase Mobile, you have control over where the data is hosted - you have the option of persisting the data in Couchbase servers that you can host in private/public cloud (AWS, Azure, GCP).
Note on Cordova support in Couchbase Lite:
It is supported as a community project in Couchbase Lite 1.4. However, in the latest 2.0 release, you will have to develop your Cordova plugin on top of the native API .
I need to make a database stored in the cloud for an application. i just need to store and retrieve images from that database to the application. i found Couchbase and i think that's the way to go for me, but im not really sure of how to start.
I suppose that if i want to use Couchbase as a database i need to install it in my computer and it will use my computer as the server. but i need to do that on the cloud, because i don't have a computer that i could use 24/7 as a server. so im not really sure of how i could install Couchbase in the cloud.
I have the vague idea (from reading the AWS page) that some hosting servers out there have the option of using them as a computer where i can install linux or any other operative system, and then install couchbase there, but im not really sure if that's true.
So, if that's the case, is there any cloud (or web) hosting service that you recomend that could do what i need? it would be better if its free, because its a class project, but i don't mind if its paid if it has a 30/60/90 days of free trial. could amazon's AWS or HP's Helion Eucalyptus do the job?
How do i install the Couchbase database in that hosting service?
If using Couchbase in the cloud doesn't work like i think it works, how can i do what i need?
I'm really confused, thank you in advance.
You are correct that you need a server (somewhere) and just install Couchbase server on it by following the Couchbase instructions.
Or you could use the AWS prebuilt version.
Using a database to store images (or any large binary data) is usually a terrible idea. They already invented a database for storing files - it's called a filesystem.
Glib replies aside, you really should consider using the built-in mechanisms you get from cloud providers for storing binary objects; if you're using AWS, then S3 would be my first choice. You get all the benefits of a distributed database: reliability, scalability, etc., but without the unnecessary complexity of using a database for something as simple as storing binary blobs. Some further reading on using S3 for object storage: http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingObjects.html
Now, there are some use-cases where it might make sense to use Couchbase for storing images, mostly if you need the high performance that you get from the built-in cache in Couchbase to retrieve the images very quickly. In such a case, here is a short list of steps to get you started:
Sign up for the AWS free tier: https://aws.amazon.com/free/
Get set up for AWS EC2: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/get-set-up-for-amazon-ec2.html
Follow the getting started guide to create an AWS VM instance: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EC2_GetStarted.html
Install Couchbase: http://developer.couchbase.com/documentation/server/4.0/getting-started/installing.html
I'm a web developer and used to using FireBase for a lot of my projects. Much of the work is already done out-of-the box there regarding realtime synchronization etc. In my next project, however, I'm not allowed to use an external provider for storing data, and as there's no way to host Firebase on a local server, it's out of the question.
For that project, currently a Redis key-value store is used. I know Redis also supports a pub-sub model, and I'm searching for a good way to use this Redis key-value store in a realtime web application. I've found a Meteor library (https://github.com/meteor/redis-livedata), which looks promising. I'm used to using AngularJS, however. And the majority of the solutions I found only use Redis for the pub-sub model, and not for the datastore (maybe for good reason). I've found an alternative which uses Django as the datastore (https://github.com/mburst/django-realtime-tutorial). I've also come across Firehose (http://firehose.io), but this doesn't use the Redis key-value store either.
Does anyone know a good way to emulate the same functionality Firebase provides, using a Redis key-value store, preferably compatible with AngularJS?
Correction - Django is a python based web framework, not a datastore .
For your requirement , tools like deployd and loopback suit alot.
They are opensource versions of services like Firebase or Parsed.
Both of them work with javascript(nodejs) and hence would support AngularJS or any other framework you would want to use.
For datastore backend, most preferred pluggable backend is mongodb as it supports fast writes, rich querying, and persistence of data.
Please check the answer and comments of my previous question in order to get a better understanding of my situation. If I use Google DataStore on AppEngine, my application will be tightly coupled and hence loose portability.
I'm working on Android and will be using backend which will reside in the cloud. I need client-cloud communication. How do I build an application maintaining portability. What design patterns, architectural patterns should I be using?
Should I use a broker pattern? I'm perplexed.
Google AppEngine provides JPA based interfaces for its datastore. As long as you are writing your code using JPA APIs, it will be easy to port the same to other datastores (Hibernate for example also implements JPA).
I would ensure that the vendor specific code doesn't percolate beyond a thin layer that sits just above the vendor's APIs. That would ensure that when I have to move to a different vendor, I know exactly which part of code would be impacted.
It u really want to avoid portability issues use google cloud sql instead. If u use the datastore unless its a trivial strucfure you sill not be able to trivially port it eve if you use pure jpa/jdo, because those were really not meant for nosql. Google has particularifies with indexes etc.
Of course sql is more expensive and has size limits
In order to maintain portability for my application, I've chosen Restlet, which offers Restful web apis, over endpoints. Restlet would help me to communicate between server and client.
Moreover, it would not get my application locked in to a particular vendor.
We have used Couchbase Server in our product. Its an Intranet application whose front end is pure JavaScript. We however use Erlang/OTP for the Business Logic, authentication (Mnesia), yaws web server and a bunch of other erlang libraries.Now, we are still using the Couch Base Single Server whose download has been removed from the Couch base site. We have found it very stable. In now, 5 months of running live, it has never gone down. We are running it on top of Ubuntu Server. So, our interest in NoSQL is just beginning. However, as i asked a question and another here about Erlang Client support for Couch base server, i discovered that they say:
Couchbase Server is memcached compatible. This means many existing memcached client libraries and in many cases, the applications already using these libraries, may be used directly with Couchbase Server
So i then started looking around for these memcached compatible libraries and have found a bunch of them: at Google code, Erlang Mc,erlmc, mcache, memcached-client and finally OneCached By Process One (Makers of Ejjabberd XMPP Server). With my great aim (if possible), of implementing my own client for Couch Base server 1.8 and 2.0 , the question follows:
1 . Which of the above memcached Erlang Client libraries is appropriate for use with Couchbase 1.8 and 2.0 ?2. If it is compatible, can i directly use it, or i have to make some changes first ? please do explain the changes ? 3. Is anyone out there feeling the need for Erlang Client support for Couch Base server 2.0 and 1.8 as we do ? How are they working their way around this problem ? I would appreciate it, if a Couch Base insider having membership here on stackoverflow, do tell us if Couch base team has plans of building us an Erlang Client possibly in any near future so that we do not waste our time attempting so, as they are in position of building a much better and efficient client to their own server, than we can. Thanks to all
Couchbase doesn't have any plans to release an erlang client in the near term. We use Erlang in our product and really like Erlang, but don't have time to put together an Erlang client at the moment. If you are interested in developing an Erlang client we are certainly happy to help and will answer any questions you might have. If you send me an email (see my profile) I will help get you in contact with someone at Couchbase who can help answer questions and get you started on development.
Also, I am not an Erlang user so I am unable to answer any of your questions related to memcached Erlang libraries. Hopefully someone who has can help you.
I have tried erlmc. I make heavy use of it for storing 32K binaries and it has worked great so far.