Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using C++ for backend calculations in a web app

I'm running a PHP front end to an application that does a lot of work with data and uses Cassandra as a data store.

However I know PHP will not give me the performance I need for some of the calculations (as well as the management for the sheer amount of data that needs to be in memory)

I'd like to write the backed stuff in C++ and access it from the PHP application. I'm trying to figure out the best way to interface the two.

Some options I've looked at:

  1. Thrift (A natural choice since I'm already using it for Cassandra)
  2. Google's Protocol Buffers
  3. gSOAP
  4. Apache Axis

The above are only things I looked at, I'm not limiting myself.

The data being transferred to the PHP application is very small, so streaming is not required. Only results of calculations are transferred.

What do you guys think?

like image 214
Stephen Holiday Avatar asked Sep 22 '10 03:09

Stephen Holiday


People also ask

Can I use CPP for backend?

Most high-level machine language libraries use C++ as the backend. C++ is faster than most other programming languages and also supports multithreading with concurrency. Thus in Applications where speed along with concurrency is required, C++ is the most sought-after language for development.

Can we make web application with C?

C and C++ language doesn't have a mature and stable rapid web application development Framework like other high-level language framework. Popular C++ web application framework are : TreeFrog, CppCMS . These are not mature enough to fulfil current needs.

Can you build web apps with C++?

Develop web applications in C++ Wt is a web GUI library in modern C++. Quickly develop highly interactive web UIs with widgets, without having to write a single line of JavaScript. Wt handles all request handling and page rendering for you, so you can focus on functionality.


1 Answers

If I were you I'd use thrift, no sense pulling in another RPC framework. Go with what you have and already know. Thrift makes it so easy (so does google protocol buffers, but you don't really need two different mechanisms)

like image 86
Brian Onn Avatar answered Oct 02 '22 21:10

Brian Onn