开发者

Social network architecture, C++ Clients Neo4j database what between?

开发者 https://www.devze.com 2023-02-23 11:11 出处:网络
I\'m currently working on the implementation of a social network. The architecture is: - Distributed C++/Qt clients

I'm currently working on the implementation of a social network. The architecture is:

- Distributed C++/Qt clients

- Neo4j server database

I could directly query the database since 开发者_C百科it has a REST interface from my Qt apps. I'm not quite comfortable with this approach because it is not secured, and no optimizations (caching requests) are possible.

What server/architecture should I use for managing requests from the clients?

I am more Python than Java but here speed matters.

And do you think REST is fast enough or should I use RPC?

In the last scenario, it means I should develop my own server implementation for the database.


REST will be fast enough. Use it until you can measure and have some real data that tells you it's a problem.

But I wouldn't use the REST API to deal directly with the database.

I'd add layers between the two that manages security, validation and binding, use cases and error handling, logging, transactions, etc.

If you were doing this in Spring it would be controllers that would worry about the first two and services that would deal with the last two.

Yes, it's more complicated that client/server directly to the database, but you're buying something you want (security, etc.) at the cost of more layers and more code. Decide what it's worth to you.

Speed matters, of course, but the limit is more likely to be set by network latency than anything else. If clients are coming over the Internet, that means an average of 12 router hops to get to your app. I see 70 ms roundtrip for latency on my corporate intranet. Let that be a gauge for speed.

As for what's important, I think a social networking site should worry about scaling to lots of visitors. The architectures I'm aware of are thread pools and request queues, with one thread per incoming request, or non-blocking I/O like Netty. I think the Python equivalent to Netty is Twisted.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号