Upgrade couchbase server community edition from

We have below version of couchbase server, sync gateway and couchbase lite (Android 5.1 to 8.1 compatible app ) in our environment today.
Couchbase Server CE 5.1.1
Sync Gateway 2.1.1
Couchbase Lite 2.1.0

But since we are facing lot of issues like erl.exe consuming higher memory, doc not created in bucket, data sync issue etc. we decided to upgrade the whole package. Can you suggest us which version should we upgrade to and provide the process guideline as well.

Always a good idea to upgrade to the latest version if you can.

For upgrading Server, start here: https://docs.couchbase.com/server/current/install/upgrade.html

For upgrading Sync Gateway, start here: https://docs.couchbase.com/sync-gateway/current/advance/deploy/upgrade.html

For upgrading Couchbase Lite, it will depend on which language/platform you’re using. For C#, for instance, you can start here: https://docs.couchbase.com/couchbase-lite/current/csharp/advance/csharp-dep-upgrade.html