I ask advice here on what matter. The mobile project is in its infancy. I myself am Javist with extremely little experience. While the startup will be written on its own knees, and if it does, it will hire a team of bodybuilders and programmers.

Question. What scheme and technology to use for the backend mobile application? Only Java + Spring + REST + MongoBD + JSON comes to my mind. Whether in the future such a scheme will keep a high load of multiple connections and queries. Now it will be 5 requests per hour, and in the future there may be 1000 requests per second.

Requirements.

  • backend is desirable on java, since I myself will write at first.

  • The specifics of the project - "instagram for three cripples." Therefore not a relational mongodb

  • Clients will cling over the android (I will write myself) and order iOS on the outsource.

  • How justified is the Java + Spring + REST + MongoBD + JSON scheme in general? How do social messengers and networks work at the microscale? By json over http?


So no one can say anything. I went here infu. What is better to keep loads on the backend with multiple connections?

Spring REST or websocket?

  • 2
    программистов-бодибилдеров - what do you have to do in order to become so? - GVArt
  • Yes, it is sarcasm. - Yuri Gagarin

1 answer 1

Want to Rest (i.e. one-time requests):

1) Node js - Asynchronous, good scaling, does not require typed code (although typing is present on some levels) With 10k connections, the answer is 170+ ms

2) php, and specifically would advise Symfony 4+ and FOS Rest to it in addition Rest write amazingly conveniently, starting with version 4 of the symphony 80% of the code can be written using comments, many functions for generating interfaces to the database tables (models), generating the tables themselves and other things

If you want realtime connections, then websoket - choose in ascending order from node.js, Java, C (any of the family)

And now specifically on your problem: Now messengers are written in several ways

1) Pooling - asynchronous requests to Rest, upon the arrival of the response of which, a new one is sent. Thus, there is an eternal survey of new messages and information from friends and subscribers, etc.

2) Replacing http requests (pooling) with a connection (websoket) - the meaning is the same, only instead of always polling the server for the presence of new information (and the server actually prepares the response and answer every time), a one-time connection is created and the server sends new data if there are any. The load of computing on the server is falling, but the load of memory is increasing, because connection for each client must be kept open.

This is with regard to the messenger, there should be a normal Rest separately, for static requests that do not require connection support (login, registration, receiving information, a list of friends, groups and other things)

  • Thank you very much for the answer. Currently Node.js is not considered, because I know java, but in js I still swim strongly and I don’t want to fill a bunch of cones on my project. As I understand it can be a scheme Spring + REST by websocket ??? - Yuri Gagarin
  • @Yuri Gagarin, you can Spring for Rest and open a web socket connection on top of its HTTP server on another port. But you need to join it not in all parts of the client, but only in the right cases: for messaging. And to inform about new messages from the server on any page, you can use the same push notification - Sergey Sharpov