Java EE & Streaming Architectures 40
Amin Ahmad writes "Implementing a streaming architecture on a Java EE application server provides asymptotically better memory performance, and, hence, scalability, than current, widely-implemented, Java EE patterns endorsed by Sun. This article provides a concrete implementation of a streaming architecture and compares its scalability to two other, standard implementations: Remote EJB and Local EJB-based solutions. The implementation based on a streaming architecture comes out the hands-down winner: for example, when sending back 300 rows of data to the client, the Local EJB solution fails beyond 16 concurrent users whereas the streaming solution is still running at 128 concurrent users!
The article includes complete source code and the entire results database for the stress test. I would be interested in hearing your feedback."
Re: (Score:2)
Re: (Score:2)
Interesting, but... (Score:3, Interesting)
1. Other than MySQL, it doesn't specify the software in use (it implies Apache Tomcat, but that is not explicitly stated), except...
2. Microsoft Web Application Stress Tool. Pardon me if I refuse to put any faith into tools by Redmond. Particularly since, if Tomcat was in use, MWAST is being used instead of Apache's own ab [apache.org] tool.
3. Why wasn't Java 1.5 tested? By definition, Java 1.4 means that you're testing vs. EJB 2.x instead of EJB 3.x. I don't know what changes have been made between the two, as I haven't learned EJB, but I'm assuming there have been some changes between the two, for better or for worse.
4. What's causing the OutOfMemory errors? If a pair of servers are falling over at 16 simultaneous requests for a 301 row dataset, there's a major problem.
Just some thoughts.
Re: (Score:1)
So that's about 47 megs as a lower bound for 16 users (16*10*300). A strict upper bound would be about 750 m
Re: (Score:2)
Re:Interesting, but... no. (Score:2, Informative)
Another obvious problem is that he's "testing EJBs" by completely ignoring them. He uses Java 1.4, sure, but the bigger problem is that he's not actually using EJBs at all - he's fetching the data directly from the DB in the servlet, and his "local EJB" returns the data immediately while his "remote EJB" serializes it.
This isn't what EJB does.
This is a retarded "benchmark." A real benchmark might be useful, but it'd require actually figuring out what kind of EJB implementation would make sense on the b
Re: (Score:2)
The real flaw in his benchmark is that he didn't publish the heap size he's using. We run JVMs with 1.7G heaps around here, and I'll bet his benchmark
Re: (Score:1)
The test is invalid. He's actually doing far MORE work with his "EJB" than a "real" EJB application would. I've written a version of his application, using actual EJBs and a decent architecture. The memory usage is nowhere near "worse" with the EJB version, because the container caches the entities. The scalability he illustrates is rubbish.
Re: (Score:2)
What's causing the OutOfMemory errors? If a pair of servers are falling over at 16 simultaneous requests for a 301 row dataset, there's a major problem.
They're probably caused by not upping the default for the maximum amount of memory the JVM will use and not using a database connection pool. Considering how inept the rest of the "Streaming Presidents" article is, it wouldn't surprise me if these are the problems.
Try GlassFish (Score:1)
Re: (Score:2)
Java vs typical web languages isn't the sort of fight Java minds on a performance front. Performance certainly isn't the thing that makes a servlet/jsp design suck.
Java vs Flash equally isn't exactly a problem on a performance front. Find someone who switched from Java to flash for performance. It's got flexible networking and rendering that wipe the floor with flash. But flash, evidently, is easier. Java again seems to lose in that fight as it's
Re: (Score:3, Informative)
We're not worried about performance of the front-end machine that's running Java. We're worried about the performance of the back-end cluster that's running the real MPI/FORTRAN codes. We're worried about the performance of the networks that connect all our bits and pieces up. We're worried about the performance of the databases that we're
Re: (Score:3, Informative)
> Java minds on a performance front. Performance certainly
> isn't the thing that makes a servlet/jsp design suck.
Well said indeed. The bottleneck there is rarely the VM, it's the database queries or the network connections or disk I/O or something else. That's the strange thing about the "x doesn't scale" argument where x == Ruby|Python|Java - once you get a certain number of servers, the speed at which the language opcodes are being processe
Re: (Score:2)
The give away is the "Compile once, run anywhere" comment. If you think that I'm going to develop my current project that is being deployed on an AS/400 on an AS/400 workstation (if there is such a thing), you've got to be kidding. Same with the J2ME app in my link, do you think I develop and compile on my phone?
I know I'm feeding a troll, but unfortunately there's probably someone out there who b
Re: (Score:2)
Re: (Score:1)
No, there isn't. Server only.
rd
Re:Java is great for learning (Score:4, Insightful)
Wow, so much ignorance in just one post.
JSP is a nice try to eat into the PHP market.
Nope, different markets. JSP is for people who understand the Model, View, Controller architecture and are capable of building systems around generalised code (POJO's). PHP is ideal for small scale web apps, but that's it - it encourages unstructured code and no separation between presentation and business logic tiers.
But it's so slow and far away from the reality of productive systems that the Apache crew rather forked their server to a Java-only server (Tomcat) to keep their httpd codebase clean and free of anything that is Java.
Tomcat originated with Sun, as a proof of concept web container. The code was donated to the Apache foundation, and there has never been any plan to merge it with the Apache HTTP daemon. People usually proxy from Apache to Tomcat, as they have static content to serve as well, or just to keep web servers in the DMZ behind a single firewall and the web container servers behind a second firewall so that database connections and things like CORBA connections are more secure.
EVen if Java is open source now. There is a reason why Java applets have become almost distinct. Even Flash evidently performs better than an Java applet.
I assume you mean "extinct" rather than "distinct". However, applets have bugger all to do with JSP and webapps. They were a neat way of promoting the Java platform when it came out, but are tiny part of what made Java popular.
And why the hell would anyone still need this "Compile once, run anywhere." nonsense?
Because it's easier to port a virtual machine than a complete toolchain.
Re: (Score:2)
So JSP is for people who understand Java buzzwords and PHP is like a joke compared to JSP, eh?
Smalltalk "buzzwords" actually, that predate Java by years. If you don't know what MVC is, go and look it up. If you still think it's rubbish, then I hope I never get to use any of your code. As for POJO's, they are classes that encapsulate some funtionality (such as user administration for example) but they contain no presentation logic such as a user interface. Multiple interfaces can be created (Swing, JSP,
Re: (Score:1)
There's lots of things Java offers that are in addition to the language, which are what really won the enterprise space. C/C++/C#/.NET/PHP/Ruby/ROR do not have it. Basically, it's this - you can write relatively complex code quickly, easily, and have it scale while being HA (High Availability) and highly reliable. That doesn't mean dweeb code monkeys can produce such code, however. The quickly and easily terms are highly s
Re: (Score:2)
Non-scalable like Yahoo, the world's busiest web site, you mean? Yeah, thought so. Don't get me wrong, PHP has many problems[1]. The biggest of them is probably the ease with which an incompetent moron can create terrible code (a trait it shares with Perl). But to claim it doesn't scale is pure religious bigotry rather than being based in fact.
[1] As indeed does Java. But that's a discussion for another day.
Re: (Score:2)
I'll still maintain that PHP is not inherently scalable for applications without major hack type gyrations. The persist to DB method discussed here [phplens.com] is something that works for low-volume high latency type applications. While PHP may be great at serving se
EJBs suxx0r (Score:3, Informative)
Re: (Score:2)
A lot of the "helpful kits" purport to make your life easier by vendor lockin to a dev kit with tons of boilerplate code that would have to be painfully changed on migrations or even upgrades <-- read this as "non-portability: maintenance nightmare part 2"
Lastly, a single appserver on modern relatively inexpensive hardware can easily serve 5
Hmmm... (Score:2, Interesting)
Even though they return 1000 rows, 50 requests per minute is pretty poor. Voca processes 80 million bank payment per day using Spring [infoq.com].
Re: (Score:1)
Surprise, surprise... (Score:3, Informative)
Adding layers to architecture is not primarily done to increase performance, but to create clean and easy to maintain design. If the implementation is not performing as required, it should be profiled and only then critical parts should be optimized for performance. If somebody in my team would dare to write code similar to this "streaming architecture" (read: plain old servlet with database access and model object polluted with html tags) it would be his last contribution to the project.
Re: (Score:2, Insightful)
Re: (Score:2, Informative)
But as a developer, you should always consider if you need technology like EJB. EJB an
Re: (Score:2, Informative)
Re: (Score:1)
Then the EJB/Hibernate implementation would wipe the floor with his stupid freshman code.
This article doesn't deserve this kind of attention.
All said reporting isn't the strong side of classic EJB or Hibernate based programs.
I'd recommend that you write the CRUD dependent code of your application using Hibernate and use a reporting program with plain SQL to generate reports if you have a lot of data. EJB or Hi
Re: (Score:2)
To have one and only one copy of each president pojo in cache and shared among all threads would work in this test because the POJOs are read-only, but in a more real-word scenario, you'd have to make copies of them before returning them from the cache or protect access to them with synchronized blocks, which would kill the scalability.
So, now that you're copying the objects before returning from the cache, each request has its own copy of the president
A good reminder if anything. (Score:2, Insightful)
So the moral of this article, if you read and process any decent am
Clarifying several points (Score:2, Informative)
The article compares two classes of algorithms with asymptotically different memory usage:, traditional store-and-forward approaches against a streaming architecture. It is similar to comparing quicksort with bubble sort and saying that one is an (n log n) algorithm while the other is n^2. The point of the practical example is