As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Which is the best Java memcached client, and why?
As the author of spymemcached, I'm a bit biased, but I'd say it's mine for the following reasons:
Designed from scratch to be non-blocking everywhere possible.
When you ask for data, issue a set, etc... there's one tiny concurrent queue insertion and you get a Future to block on results (with some convenience methods for common cases like get).
Optimized Aggressively
You can read more on my optimizations page, but I do whole-application optimization.
I still do pretty well in micro-benchmarks, but to compare fairly against the other client, you have to contrive unrealistic usage patterns (for example, waiting for the response on every set operation or building locks around gets to keep them from doing packet optimization).
Tested Obsessively
I maintain a pretty rigorous test suite with coverage reports on every release.
Bugs still slip in, but they're usually pretty minor, and the client just keeps getting better. :)
Well Documented
The examples page provides a quick introduction, but the javadoc goes into tremendous detail.
Provides High-level Abstractions
I've got a Map interface to the cache as well as a functional CAS abstraction. Both binary and text support an incr-with-default mechanism (provided by the binary protocol, but rather tricky in text).
Keeps up with the Specs
I do a lot of work on the server itself, so I keep up with protocol changes.
I did the first binary protocol server implementations (both a test server and in memcached itself), and this was the first production-ready client to support it, and does so first-class.
I've also got support for several hash algorithms and node distribution algorithms, all of which are well-tested for every build. You can do a stock ketama consistent hash, or a derivative using FNV-1 (or even java's native string hashing) if you want better performance.
I believe memcached java client is the best client.
Features
Binary protocol support. fastest way to access the key/value stored in memcached server.
UDP protocol support. You can set key with tcp protocol, and get with udp protocol. Acctually, some big corporations are doing like this.
Support customized serialization and deserialization.
Connection pool with NIO and direct buffer. Dynamically increase connections when out of use for the connection pool.
Performance
Refer to performance for a benchmark test of existing popular memcached java clients.
Deserializing while receiving the response
Performance tuning into each line of the source code.
If these are numbers still valid, then ... http://xmemcached.googlecode.com/svn/trunk/benchmark/benchmark.html
As of about a year ago, when I had to use a memcached java client, the spymemcached connector was described as an optimized API with more features. Since then there've been a number of new releases of the memcached client so it may be worth checking out.
FWIW the spy client has worked perfectly for me.
I have been using SpyMemcached and have to agree that it is the best one available out there, with lots of newer improvements.
There is the memcached client for Java and spymemcached. Not much experience with either though.
Please try xmemcached, it is also nio based and have some powerful features.
Related
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
I need some help on how to choose a technology for developing mobile apps. I have decided to use phonegap (cordova library) and Jquery mobile with HTML and complete my device APIs and UI parts.
Now I am in a dilemma, on which technology to use to connect to a database -
1. PHP
2. .NET
3. JAVA
I heard/read PHP is light-weight and is easy to work with but .NET is more robust and secured. Now, I am unsure of what exactly security here means? Does it mean PHP is not a secured way to handle database operations?
Can anyone please guide me on how to decide on a technology and take my development to a higher level?
I can give you more inputs as required. :)
Many thanks.
If you never ever touched any of these technologies you should use the easiest one.
Your priority should be like this, I will rank then from according to their usability/simplicity:
1. PHP
Good:
By far simpliest of them all. In a matter of days you can learn more then enough to create your basic server. No matter do you want to handle only REST calls or do full a page creation on a server side.
It has largest overall support and you will easily find hosting, if you already don't have it. It works on all current desktop OS's like Windows, Linux and MacOS.
Bad:
Not that much. If I have to think of any I would say that it is a smaller brother of Java and .NET.
2. .NET
Good
My favorite, more secure (but not that much secure) then PHP. It requires much more time to handle and use right. Like with Java I prefer its syntax over PHP. Still more readable syntax then Java, specially if you delve into something more complex.
Bad:
But, as it is a Microsoft technology it will run only on a Windows platform. Skipp it if this is a turn off for you.
3. Java
Good:
Almost best of both worlds. Better and more powerful syntax then PHP and unlike .NET you can run it on any available platform. Like .NET it requires more time to master correctly then PHP.
Bad:
Java is usually used in large corporate projects and you will not find that much help over some basic stuff and usage. Even if you master it correctly you will still need to delve into Java EE if you want to create anything decent and robust, basically it is a largest time sink if you only need to create one server application. Other problem is memory consumption, that is why you will see much less available Java hosting platforms the it is case with .NET and PHP.
Conclusion
If you don't have that much time and you are not sure you are ever going to use it again then stick to PHP. If you are planing on using this technology for a longer period then stick to .NET. And finally if you are going to use it in a longer period but Windows platform is a turn off then stick to Java.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
I am writing a server (Java based) which will be only called by program on the same host.
So, in term of performance & reliability, should I use UDP or just Unix Socket?
UDP is not reliable. I'm picking nits, but there is no guarantee of either delivery order or delivery at all with UDP. Between two processes on the same host, this is probably never going to manifest as a problem, but it may be possible under extreme load scenarios.
There's also a lot more overhead in a UDP packet than there is in a Unix socket. Again, this is unlikely to be a practical problem except under the most extreme load, and you'd have a lot of other load-related problems before that was a concern, because the overhead for both is nominal in modern computing terms.
If you're really worried about performance and reliability, stick with Unix sockets.
If you have any plan to distribute and load-balance it in the future, UDP will give you more flexibility if you need to support multiple hosts.
Having said all that, none of this is a practical concern these days. Most services use TCP for even local communication, and then layer other services like ZeroMQ on top of that. You almost definitely should not be worrying about that level of performance. Use software that makes your code easier to write and maintain, and scale up the system in the unlikely event that you need to. It's easier and cheaper to throw new servers at problems than it is to spend man-hours re-engineering software that wasn't written to be flexible.
Also note that ZeroMQ (and other message queueing systems) will pick the most efficient transfer mechanism available. For example, ZeroMQ will use IPC (inter-process communication) if possible, which is far faster than either UDP or Unix sockets, and it will also scale up to thousands of hosts worldwide over the Internet if you need that, and you basically won't have to change your code.
Never prematurely optimize.
A unix socket will certainly spare you the overhead of context switching and encapsulation/decapsulation through the tcp/ip stack. But how perceptible that gain will be ? I think it depends on your requirements for performance and reliability and on the load you're expecting this server to handle.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I am currently using BlazeDS and covet the features of LCDS, but am never going to ask my customers to pay the $$$. Therefore I am considering starting to build these capabilities myself, using third party tools (dpHibernate?) or switching to GraniteDS.
Since, we are coming up on the two year anniversary of the last time this question was asked, I thought I'd ask it again.
Since that time, Spring-Flex has added Hibernate serialization support to BlazeDS to avoid lazy init exceptions. There is also a new BlazeDS configuration option to serialize read-only properties.
On the other hand, the Tide capability of GraniteDS seems to be maturing.
Plus the servlet 3.0 spec has been out for a while and maybe the additional support for NIO makes a difference for those who need push-type messaging.
So what's the latest?
As of today (February 29, 2012), the GraniteDS community is still very active, the product evolves with new features on a regular basis and you can get developer and production support if you run into technical issues (see here) or just want a kind of insurance for critical deployements.
GraniteDS' messaging is based on asynchronous servlets, it is mature (introduced late 2007), proven in demanding production environments and much more scalable than the BlazeDS messaging stack (based on classical servlets).
I've never used GraniteDS in production, but in my opinion it will always have more goodies than BlazeDS..unless some company will decide to make money from BlazeDS, like adding features, offering paid support & professional services. I think that Farata Systems is doing that but probably they are doing custom development for various clients..and not adding features into the mainline.
So probably from a productivity point of view GraniteDS can be a good choice - before choosing it I will double check if the community is quite active, if you receive answers to your technical question on their forums and most important if it's easy to understand the GraniteDS source code in case you run into technical difficulties.
Related to messaging I assume that if you wish a professional solution you will not choose niether BlazeDS not GraniteDS - there are dedicated solutions on the market. If not both should be ok (BlazeDS has a little bit more options from what I know).
By professional solutions I mean LCDS, Lightstreamer, Kaazing (and probably more). Some important features from LCDS which are not included BlazeDS: reliable messaging, message throttling, the ability to deploy the solution in architectures where DMZ is a must (http://www.lightstreamer.com/architecture.htm), the ability to connect also to non Flex clients (HTML).
Actually we (Farata Systems) continue improving our open source offering that works nicely BlazeDS. The latest version (4.2) of our tool called Clear Data Builder can generate CRUD applications in minutes based on Hibernate or POJOs. We hooked up Spring framework too - all BlazeDS client's requests are processed by Spring's DispatcherServlet.
Here's the Wiki Page http://cleartoolkit.com/dokuwiki/doku.php. There are screencasts and a workshop at the bottom of the main Wiki page that takes you step-by-step through the BlazeDS with Hibernate process and you'll also see how easy it is to connect the Spring Security module. We support data synchronization, hierarchical data collections, transactional updates, pagination, and more.
Apparently, we need to make more noise to make this nice (and free) product more popular :)
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
I'm planning to build a small multiplayer game which could be run as a java applet or a flash file in the web browser. I haven't done any server programming before, so I'm wondering what sort of server architecture i should have.
It'll be easy for me to create perl/php files on the server, which the java/flash code contacts to update the player position/actions, etc. But I'm considering whether i should get a dedicated web host, which OS to use, which database, etc. Also, the amount of bandwidth used and scalability is a consideration.
Another option could be using a cloud hosting system (as opposed to a dedicated server), so they would take care of adding additional machines as the game grows. As long as each server ran the core perl/php files for updating the database, it should work fine.
Yet another option could be using Google app engine.
Any thoughts regarding the server architecture, OS/database choice, and whether my method of using perl/php/python scripts for server-side programing is a good one, will be appreciated!
You need to clarify more about the game, and think more about architecture rather than specific implementation details.
The main question is whether your game is going to be in real time, turn based, or long-delay based (e.g., email chess). Another question is whether or not you are going to be freezing the state for subsequent reloads.
I would highly recommend figuring out in advance whether or not all players in the same game are going to be hosted on the same server (e.g., 1000 of 4 player matches compared to 4 matches of 1000 players each). If possible, go with the first and stick everyone who is in the same game under the same server. You will have a hard enough time synchronizing multiple clients to one server, rather than having multiple servers against which players are synchronized. Otherwise, the definition of consistency is problematic.
If possible, have each client communicate with the server and then the server distributing updates to the clients. This way you have one "official state", and can do a variety of conflict resolutions, phantoms, etc. Peer to peer gives better performance in faster games (e.g., FPSs) but introduces tons of problems.
I cannot for the life of me see any convincing reason to do this and perl or PHP. Your game is not web based, why write it in a web oriented language? Use good old J2EE for the server, and exchange data with your clients via XML and AJAX. If possible, run a real Java application on clients rather than servlets. You can then benefit from using JMS which will take a huge load off your back by abstracting a lot of the communication details for you.
For your server architecture, you might have a look at Three Rings' code. They have written a number of very scalable games in Java (both client- and server-side).
I would also discourage from using PHP, also HTTP isnt the best idea as it is stateless and talkative. I was working for some time in company currently developing really massive multiplayer game. The back-end is plain JVM (being connected thru tomcat by multiple clients and from mobiles one per client). So I know the less data you transfer the smaller buffers you need on server -> more clients on one machine and also a bit faster responses. Also consider security, https is quite expensive, especially if you need to transfer graphics and sounds. Binnary protocol of your own with non-browser client container would do the best (good choice is switchable protocol for the development-debugging time). Maybe sounds complicated but it isn't.
#Sarah nice hint, thanks too ;)
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
We are using ActiveMQ 5.2 as our implementation of choice and we picked it a while ago. It performs well enough for our use right now. Since its been a while, I was wondering what other Java Message Service implementations are in use and why? Surely there are more than a few.
Before delving into JMS, consider AMQP as well - might be a new standard.
JMS providers I worked with (in varying degrees):
TIBCO EMS - very quick and robust, good API support, Java friendly, native C API exists. Best commercial choice I've used.
Websphere MQ (and its JMS implementation) - so, so. Pub/sub not exactly quick, many configurations options and choices are 'strange' and overly complex from the long history of that product. Just look at the amount of documentation...
Solace JMS - very high throughput (the JMS broker is built in hardware !), good choices of connecting protocols (MQTT, AMQP, XML over http as admin protocols)
Fiorano MQ - used to be agressive in marketing but lost a lot of market share, maturity concerns
Sonic MQ - solid product, also supports a C API
Active MQ - if you want to go with an open-source product (unexpensive support, great community, limited add-on products, limited enterprise features) this is probably your best choice. Works out of the box and is the backbone of several tools like Apache Camel, for example.
We rely on AMQ (5.1) via the Camel framework, and there haven't been any issues. AMQ 4 was a tad more fishy.
WebLogic JMS provider when using WebLogic. Works great.
TIBCO EMS. It's a commercial message service with Java/JMS, C, .net, and other bindings for it.
Sun's Open source OpenMQ (https://mq.dev.java.net/). You can get free and paid support for the same.
See this blog post about some comparison with ActiveMQ, etc -- http://alexismp.wordpress.com/2008/06/06/openmq-the-untold-story/.
I've heard that OpenMQ is more stable.
ActiveMQ is more flexible. as in, you can use it with more languages. There are probably more people on ActiveMQ's mailing list than OpenMQ.
In one of the recent projects I was in we used Sonic MQ. Good overall implementation with good bindings to .NET.
We had a little of scalability problems, but I have to admit that the scalability requirements were very strict: if I can recall correctly, something like 20,000 messes a second with no delays allowed between the 200 different clients (every client had to receive every message at the same time).
I've used JBossMQ, which comes with JBoss app server up to version 4, and which is solid but limited. JBoss Messaging was the replacement, comes with JBossAS 5, and is a huge improvement.
ActiveMQ I have a real dislike for. The developer(s) seem to have gone for performance and features to the detriment of stability, and it's phenomenally buggy. Given that it's the JMS fabric for Geronimo, I worry.
IBM WebSphere MQ 5 and 6
Active MQ 5.2.0
Also Check out Micro QueueManager at http://codingjunky.com/page5/page4/page4.html It is small, easy to install and use for smaller projects.
I have used ActiveMQ in production for a couple of years but I was never happy about its stability (specially with it clustered-enabled). Never looked back after switching to OpenMQ. You might want to look into RabbitMQ or ZeroMQ.
We are using SonicMQ, JBossMQ and the "micro broker" of Lotus Expeditor Integrator. We are using them for different purposes:
-JBossMQ is used internally and to communicate out of all our Java EE applications which run on JBoss.
-Lotus Expeditor is used in "remote sites" where we do only have limited resources and IT staff
-SonicMQ is our Messaging backbone, we use it for connecting central systems, but also to connect remote systems in approx. 1000 sites.
We are having good experiences with all of them, but our experience is also that with a more complex environment you have to do a more active administration of the Messaging system. This became especially true with SonicMQ at our site :-) . From a performance perspective we made the best experiences with SonicMQ especially in Queue based persistent messaging.