Ask HN: Python vs Scala for a fast web-project
I was working on a web-project lately with a friend. We faced a situation where we realized that Python was being a bit slower than expected. Also, we were planning on using a database that was not native to Python (Python bindings used its REST interface).
So, we had to make a decision to either keep going in Python or port to Scala (Scala seemed apt for many reasons).
What would you have done in this case?
14 comments
[ 1.9 ms ] story [ 39.8 ms ] threadYour code would spend most of its time fetching stuff from DB, external web services etc and rendering HTML. Does your framework allow you to easily incorporate database caches? Does it allow to to cache frequently rendered HTML segments ? Can you offload certain tasks ( such as sending email etc.) to a secondary process via a job queue ?
You could write a web application in C that could still suck big time unless you get the application architecture right.
As we were newbies to web development (although we have a lot of experience in development), we had put in our best knowledge while designing the architecture. We kept independent things independent. That's why we chose flask, it gave us the flexibility we wanted. We were free to choose the extensions we wanted to integrate.
2) Using Flask gave us so much flexibility as a framework. SQLAlchemy was probably the best thing that I've ever seen. But the work was made complex by the fact that Python was not able to give us the performance that we wanted. We tested the web-project running locally, and we noticed some exciting results. Even though we had done proper memory management from our side, the memory consumption was a little high than we had actually expected. I'm not an expert web-technologies, but as a programmer for last n years, I've learnt a lot about memory management. We projected that when the load would be actual, python performance would suffer.
3) We wanted a real-time performance application so that the user experience was the best. We implemented a part of the web-application and tested it. The results were unsatisfactory. Then we planned on shifting to scala.