4 ms·
> ... and when we look at the um... "old" fart Java... their roster is even more impressive: LinkedIN, Google, NetFlix, Amazon. Sure it is. But I won't use Jav
by irahul 14y ago
> ... and when we look at the um... "old" fart Java... their roster is even more impressive: LinkedIN, Google, NetFlix, Amazon.
Sure it is. But I won't use Java for web stuff. I might use it for some background services, but for regular CRUD functionality, Java buys me nothing. I generally use Python(Flask)/Jinja2/Flask-SqlAlchemy. Flask is intuitive; Jinja2 is pleasant and fast; Flask-SQLAlchemy is concise with the option of exploring the raw power of SQLAlchemy. For regular use cases, nothing in Java beats this combination. I have looked at Play; it comes closer but it's still not there.
Checkout this toy benchmark that was doing the rounds 2 months ago https://github.com/grahamking/Key-Value-Polyglot https://github.com/grahamking/Key-Value-Polyglot The naive python solution https://github.com/grahamking/Key-Value-Polyglot/blob/master/memg.py https://github.com/grahamking/Key-Value-Polyglot/blob/master... performs dog slow. Java has real threads, JIT; but guess what, the naive Java solution still is dog slow https://github.com/grahamking/Key-Value-Polyglot/blob/master/Memg.java https://github.com/grahamking/Key-Value-Polyglot/blob/master...
My specialized python solutions are magnitudes of times faster than both naive Python and Java solutions:
https://github.com/rahulkmr/Key-Value-Polyglot/blob/master/memg_epoll.py https://github.com/rahulkmr/Key-Value-Polyglot/blob/master/m...
https://github.com/rahulkmr/Key-Value-Polyglot/blob/master/memg_gevent_server.py https://github.com/rahulkmr/Key-Value-Polyglot/blob/master/m...
The naive solutions were taking around 20 seconds to do 500 writes followed by 500 reads. My changed solution does 5000 writes followed by 5000 reads in under 2 seconds. The 500 and 5000 aren't typos - the naive solutions was taking about 20 seconds for 1000 operations, whereas tailored solution was doing 10000 operations under 2 seconds.
This is the discussion thread http://news.ycombinator.com/item?id=3733090 http://news.ycombinator.com/item?id=3733090
I get it that this is an IO bound problem, and naturally an epoll based solution will totally smoke a thread-per-request solution, but that's the point I am trying to make. If at the end of the day, intuitive solutions don't work and I have to do custom implementations, I am not getting much out of using Java. I might use it for something which is CPU bound about 70% of the time, but anything other than that, the pains far outweigh benefits.
- edwinnathaniel 14y agoAnd the last time you use Java was....5 years ago? Better keep up with the latest frameworks and libraries. I know Rails and Django and I used cherrypy, cheetah, and sqlalchemy as well, and Java is on par with both modern frameworks if you know to choose the right frameworks. In fact, I do not have to deploy multiple processes one for Rails and one for sinatra or node.js. Just some app server or web container and I am ready to go. ... And you are asking me to check out a "toy benchmark"? I care more for the overall solutions from deployment, tools, etc. End to end baby...
- irahul 14y ago> And the last time you use Java was....5 years ago? > I know Rails and Django and I used cherrypy, cheetah, and sqlalchemy as well, and Java is on par with both modern frameworks if you know to choose the right frameworks. What are these frameworks in Java you talk about which are as expressive as Django and Rails? Less verbose that it was before isn't the same as as expressive as Rails/Django. > In fact, I do not have to deploy multiple processes one for Rails and one for sinatra or node.js. Just some app server or web container and I am ready to go. Rails/Django deployment isn't that hard. If you are talking about a large app, deployment is a very small consideration compared to other aspects. As far as multiple processes go, more often than not, large apps are run as collection of co-operating services. That is by choice, irrespective of whether it's implemented in Java or Python. Which one of the examples you listed you think runs as some app server and container? > ... And you are asking me to check out a "toy benchmark"? > I care more for the overall solutions from deployment, tools, etc. End to end baby... All benchmarks are toys. If you want "end to end", the only way is to do it is to implement the same app in Python and Java, and then compare them. Doing that would be batshit insane(sure, we are going to do too versions of pinterest to compare whether we write it in Java or Python), nobody does that, nobody should do that. As far as benchmark goes, I only claimed that out of box code in Java performs like dogshit, and I am to jump hoops, I would rather jump hoops in Python, Ruby, Clojure et al.
- edwinnathaniel 14y agoExpressive lies in the language not in the framework, I think you have a different mindset on that one but I'm not sure what you're trying to achieve. Spring MVC is on par with Rails VC (let's leave ActiveRecord for another time) or Django TV minus Django ORM. Testing? Spring has a really good testing library that plays with both straight up Java EE components (Servlet, Portlet, etc). Functional, Integration, Unit-Test, name your game. Migration? Flyway works nicely and I don't have to spend days to set it up, just less than an hour for multi-year project. Minuscule in terms of effort. It just works. I'll give you that ActiveRecord is nicer than JPA 2 (but not by a lot). The rest are... indifferent, same stuff, same type, same ol' same ol'. JAX-RS can spits both XML and JSON easily with no code changes. I don't have to use Sinatra (or node.js) for web-api and deploy it separately from Rails: just deploy JAX-RS project as a separate WAR to the AppServer and I'm done. Done. I don't need to spin up a different process, write a script to do X,Y,Z, maintain another infrastructure, etc etc. Regarding your mark about benchmark: then don't start flashing numbers and stuffs if they are toys. If OOB Java is like dog stuff then Python, Ruby are like snail or turtle. Wait, what am I doing trolling like redditors or slashdotters over mindless debate. sigh technology has never been the problem, the people are sigh always holds true.