#community-help

Implementing Self-Hosted Typesense in Production

TLDR Jainal enquired about implementing Typesense in production with specific questions about open-source disclosure and memory capacity. Jason clarified GPL-3's source code disclosure and explained risks of running out of RAM. Kishore Nallan provided strategies for data durability and clustering.

Powered by Struct AI
19
32mo
Solved
Join the chat
Mar 26, 2021 (32 months ago)
Jainal
Photo of md5-594968ce9e4fc3c22e758de7b6b38c10
Jainal
06:36 PM
Hi, I am thinking to use self hosted typesense in production for a product I am building. I have basically 2 major questions:-
1. I have seen typesense using GNU General Public License v3.0 license and in it source code must be disclosed if distributed. But since i am not distributing the software and i am basically indexing user info and when user search a particular term on my webapp the results are fetched from typesense. So, in this condition do i need to disclose source if i am using typesense.
2. I have read the docs in which it is written typesense stores results in ram. But, what happens when there no more space remaining in the ram, than does typesense stores them on disk or fails?
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
06:39 PM
Hi Jainal, as long as you don't modify Typesense's source code itself and instead use it as a standalone process, GPL-3's source code disclosure does not apply.
06:40
Jason
06:40 PM
If you run out of RAM, you'll see unpredictable results since the OS itself will start running out of RAM. You could configure swap in the OS, in which case you'll start seeing requests taking a long time to execute, since data has to be swapped back and forth between RAM and disk.
06:42
Jason
06:42 PM
Typesense does not automatically fall-back to disk, instead if you have swap space configured it is the OS that will start swapping contents between RAM and disk. If you don't have swap configured the OS won't have memory to function and it might stall other critical processes. So the OS' Out of Memory handler will kick-in and start killing processes, and it could kill the Typesense process as well
06:43
Jason
06:43 PM
I'd highly recommend setting up alerts on memory usage and proactively scaling up RAM capacity as you index more and more documents
Mar 27, 2021 (32 months ago)
Jainal
Photo of md5-594968ce9e4fc3c22e758de7b6b38c10
Jainal
01:48 PM
hi, thanks for your reply
01:49
Jainal
01:49 PM
I just had a last query,
if i am deploying typesense on a single vm on cloud. Will it be beneficial to set up a cluster configuration inside a single VM?
09:39
Jainal
09:39 PM
Jason
10:44
Jainal
10:44 PM
Kishore Nallan
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
11:20 PM
Jainal No it won’t be beneficial to setup a cluster configuration on a single VM. Because if that VM goes down then all nodes in the cluster will be unavailable
Mar 29, 2021 (32 months ago)
Jainal
Photo of md5-594968ce9e4fc3c22e758de7b6b38c10
Jainal
10:17 AM
So, by just running the docker container can i put it in production or does it require any further steps?
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
10:18 AM
If you don't need high availability, then all you need to do is to run the Docker container on the machine, that's it.
10:19
Kishore Nallan
10:19 AM
For HA, you need to set run atleast 3 instances, as described here: https://typesense.org/docs/0.19.0/guide/high-availability.html
Jainal
Photo of md5-594968ce9e4fc3c22e758de7b6b38c10
Jainal
10:20 AM
So is there configuration involving master slave for backing up the data if 1 node falls?
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
10:23 AM
Data durability will be there as long as the storage directory persists instance failure, for eg using EBS on AWS instead of ephemeral instance store.
10:24
Kishore Nallan
10:24 AM
We don't have a master/follower setup -- you need to run 3 instances since we use Raft for clustering.
Jainal
Photo of md5-594968ce9e4fc3c22e758de7b6b38c10
Jainal
10:25 AM
Oh okay understood 😊
10:25
Jainal
10:25 AM
Thanks
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
10:25 AM
👍