Sometimes system getting slow

I have been created point of sale application. It is android and ios application. User can add products and sale. User can view sales report from web application(php). I am using couchbase server 5.1 and sync gateway 1.5. I have tested slow and loading issues with more than 30,000 records. I have noted the slowness and loading issue. I changed couchbase server capacity. but still the problem is there. I am unable to solve this issue. Sometime user unable to login into application due to loading issue. Can you help me?
This is my sync_gateway json code.
“log”: [""],
“adminInterface”: “”,
“interface”: “”,
“databases”: {
“pos”: {
“server”: “http://admin:1234@”,
“bucket”: “pos”,
“users”: {
“admin”:{“password”:“test1234”, “admin_channels”: ["
“user1”: {“password”: “pass”, “admin_channels”: [“user1”]},
“user2”: {“password”: “pass”, “admin_channels”: [“user2”]}
“allow_conflicts”: false,
“revs_limit”: 20,

        "sync": `function(doc, oldDoc)
		if (!isDelete()) {
		  if (doc.type == "product") {
				var chanl =doc.store_name;

			} else if (doc.type == "sale") {
				var chanl =doc.store_name;
				log("Invalid document type: " + doc.type);
				throw({forbidden: "Invalid document type: " + doc.type});
		  function isDelete() {
			return (doc._deleted == true);
} }

Do i need to change my config file ?

This is my couchbase server. I haven’t add more node. i have single node. Do i need to add more nodes? Is it the reason for slow?

Thank you.

Hi, I would recommend upgrading to the latest Sync Gateway and Couchbase Lite versions if possible.

We implemented a new replication protocol in 2.0 which has been shown to have significant speed improvements, as well as other bug fixes in 2.1.x which removed additional unnecessary load.

1 Like

Thank you @bbrks
I will update. Do i need to create more nodes or shall i work with single node ?

Thank you.

I can’t really provide an answer to that, as it depends on hardware configuration and workload.
You should be OK on a single node until you start hitting CPU/Memory limits of that node.

I can refer you to the Couchbase Server sizing guidelines documentation:

1 Like