realm / realm-object-server

Tracking of issues related to the Realm Object Server and other general issues not related to the specific SDK's
https://realm.io
293 stars 42 forks source link

Support Realm Object Server on ARM #2

Open bynelus opened 7 years ago

bynelus commented 7 years ago

Is there anyone who knows how to get the Realm Mobile Platform work on ARM devices? Would like to get it working on a Raspberry Pi.

teotwaki commented 7 years ago

Hi @NielsKoole,

We don't currently provide a build for ARM, so I don't think it's possible to get it running. The majority of the code is C++, which means we have to rebuild everything for arm.

Just for my information, which distribution would you be targeting on the RPi? Also, which version of the RPi would you be looking at?

Thanks,

bynelus commented 7 years ago

Thanks @teotwaki for your response. Ai, rebuilding everything seems like a lot of work :/. Though a lot of new opportunities will open up!

Distribution atm is Ubuntu but it doesn't actually matter to me. If it would be any other distribution I would install that one if that will do the job. I'm focussing on the RPI 3.

Vaseltior commented 7 years ago

What is written in C++? Isn't the server running on nodejs?

bigfish24 commented 7 years ago

Currently the core sync server is C++ but used within Node which handles the user authentication and the dashboard.

bynelus commented 7 years ago

Another idea would be to run an iOS application as the Realm Object Server. This makes it easy to create peer-to-peer networks. Any ideas on that? 😃

gpulido commented 7 years ago

To have it running on a Raspi 3 would be awesome for local, testing and small development when no internet connection is available and a sync server is running on the local network. Also, to be able to run it directly on an android device will be perfect for p2p gaming.

AndyDentFree commented 7 years ago

Happy to test on the PINE64 when we have it going.

@gpulido wrote:

Also, to be able to run it directly on an android device will be perfect for p2p gaming.

In that case would you also want BlueTooth networking as an option rather than wifi?

ARM-based server and BT networking together are precursors for device sync eg Apple Watch to iPhone.

gpulido commented 7 years ago

@AndyDentFree As the sync server provides a very good abstraction of the network state, I think it would be better to have at least ethernet / wifi networking. My use case is to have several tablets / android devices (at this moment I'm using 14 + one master) that are on the same local network (without internet connection) to provide automatically annotation synchronization for an archery tournament. I'm being able to do it using Bonjour/ zeroconf (for autodiscovery) + rest server on the master + realm on each device as local storage. To maintain all in sync I have to serialize / deserialize data between all the clients and the master, and it is cumbersome and error prone. When realm-sync was releseased I automatically though on using it to have all devices automatically in sync, removing all the custom sync management, but to have it working I need one device to run the sync server. Also (on my use case of course) the sync is just to be maintained for a sort period of time (in this case an archery tournament only last 4 hours or a day at most) The best solution is to just have the sync running on the master device locally as this would avoid me to add more hardware to the system. The second best solution is to run it on a small server, and the raspi 3 is an obvious fit. However the raspi 3 at this moment doesn't have any realiable 64bits OS and the one that is out there, SUSE, realm- sync doesn't provide a package for it. The raspberries are quite popular right now. I'm even thinking on buying any small intel based pc that could run ubuntu just to replace the raspi is there is not another solution.

I think that my use case is the same for any local p2p gaming: think on a 4-6 board game , it would be soooo easy to share the gaming state...

ghost commented 7 years ago

this platform could be an absolute game changer for me. would love to see it working on 64bit odroid c2 but any RPi like device will do

bmunkholm commented 7 years ago

@ha100 Could you enlighten us a bit more on your use-case?

ghost commented 7 years ago

well lets just say that since swift is open sourced and you have the opportunity to reuse some of your code/knowledge/coders for backend implementation, it would be of a great benefit to reuse the persistence stack too. not having to worry about networking, crypto and synchronization could be great for any potential startup project or company.

bynelus commented 7 years ago

I would love to have a RPi running Realm server locally, so I can sync multiple Point of Sale devices without the need of an internet connection. Can hear my customers screaming already!

teotwaki commented 7 years ago

@NielsKoole I'm a big fan of the RPi, but I would not recommend it for production use. Please remember that the ROS is compute-intensive in certain situations (especially if multiple clients are modifying the same Realm), and I would consider the RPi to be woefully underpowered for this.

In addition, the SD-storage is very, very slow. I don't know what kind of setup you have imagined, but please do consider using an x86 platform with SSD storage at the very least.

Furthermore, the RMP sync protocol is resilient to network failure. Users can keep modifying their databases locally, even when offline, and these changes will be synced when the device gets back online.

gpulido commented 7 years ago

@teotwaki I'm curious about how much hoursepower does the ROS need. The raspberrypi 3 has 4 cores and there are even projects to use them as a base hardware host for a google app engine that should be more demanding than the ROS. I agree about the sd-storage, but since the raspi 2 it can be configured to use an usb as system drive.

In my use case the idea is to use it just for the sync without any other system interfering or stealing resources and with few clients (less than 1000, and normally less than 20)

I have a related question, If the ROS is installed in a server without internet conection, it would work for the local network, wouldn't it?

teotwaki commented 7 years ago

I have a related question, If the ROS is installed in a server without internet conection, it would work for the local network, wouldn't it?

Yes. The ROS doesn't need internet access to function, when deployed locally.

I'm curious about how much hoursepower does the ROS need. The raspberrypi 3 has 4 cores and there are even projects to use them as a base hardware host for a google app engine that should be more demanding than the ROS.

The ROS is written in mean and lean C++ code, so it's fairly performant. The problem comes from the algorithms and the work that the ROS needs to do. Imagine you have just two clients. Both clients have the same common ancestor in their sync history. One of them gets disconnected, and then starts writing 500 commits. The other client is also writing, let's say, 1500 commits. All of a sudden, the server now has to loop 750000 times to resolve all the potential conflicts and merge them. During those merges, another issue you will have is RAM. It obviously depends on your use-case, but 1GB is going to be pretty limiting. The main limitation is obviously during those merge windows, where the server does need a bit of breathing room.

Although we have some pretty amazing optimisers at Realm (just look at this for example), I don't think we have any optimisations for ARM in the sync server at the moment. We obviously benefit from very fast operations in RMD on ARM, but the ROS was designed for a server-grade runtime.

Also, please note that the server is not multithreaded at the moment (well, it obviously is, as we're developing this in 2017; but we're not using multiple threads/cores to parallelise the compute-heavy tasks). This is something on our roadmap. Alternatively, if your setup is CPU bound, we do offer clustering capabilities in other editions of the RMP, which would let you run multiple instances of the server on the same machine, which would let you leverage the multiple cores. Again, this is not targeting RPi deployments, as you can imagine.

daspuru commented 6 years ago

Hi all,

In my case, running the Realm Object and Sync servers in a Raspberry or mobile system also would be great as my use case involves a kind of field team who connects with a wifi router, but without Internet. Actually I am building a new company in which this is the core need.

Greetings!

roon83 commented 5 years ago

Can I use realm object server on raspberry pi if I use docker?

jedelbo commented 5 years ago

You would in any case need a ROS compiled for the relevant CPU architecture.

roon83 commented 5 years ago

You would in any case need a ROS compiled for the relevant CPU architecture.

Thanks, Understood.