High-performance REST API - Which language/stack? [closed] - ruby-on-rails

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 developing a site using Ruby on Rails. I would like to develop the REST API (JSON) separately to maximize performance, the Rails stack just takes away too much.
Are there any performance benchmarks out there? What do you think would yield the best performance? I am currently thinking about the following, because that's what I have experience with. Is there anything else I should consider? It should be lightweight.
node.js
Scala Spray (http://spray.io/)
Ruby Sinatra
Thanks!

Summary: Maximize your performance as a developer. Use stack you know best. First make it work, then make it fast.
Are there any performance benchmarks out there?
There are all kinds of benchmarks out there. Let's say, node.js can handle 100k HPS (helloworlds per second) and Sinatra can only do 80k. What does it tell you? Nothing.
Also, sometimes higher performance comes at a great cost. Take ruby C extensions, for example. Sure, C runs faster than Ruby, but it prevents other threads from running on other cores (because of GIL).
So, don't choose tech only by benchmark figures from the internet. There are so many factors to consider besides raw HPS number.
LINK: If you think Rails is too heavy, you should try rails-api. It's basically a stripped down version of Rails (you don't need things like cookie authentication or MSIE rendering helpers in an api server).
Personal story
I run an API server that handles some load. First version was written with Rails. Then I thought "Hey, Rails Is Bloated (c), let's rewrite everything with Sinatra". And then I had waves of frustration coming one after another. It turned out that Rails does a lot of small but helpful things which I didn't appreciate. I gave up, rewrote it with Rails again (applying lessons learned) and lived happily ever since.

This falls into the 'should I rewrite my apache/php site in C with a customized webserver because it's slow' bucket.
I vote for picking your favorite stack to work in and utilize good caching and using whatever opcode optimization you've available if your code isn't compiled. Then make sure you've got adequate server resources and load balance horizontally if needed to handle the traffic.
I've yet to see many API's whose primary reason for poor performance is the choice of technology stack unless they're handling facebook/twitter size traffic or doing computationally intensive work.
You'll see in just about any stack you choose if properly utilized more latency occur in:
Transport of unnecessarily large amounts of data to the client
Performance hits due to poor SQL or other data source fetching slowness
I'd also highly recommend if you're already using a RoR stack to stick with it. Trying to optimize and code in different stacks will generally result in weaker code in both--keep your dev's brains focused in one pool of futz at a time.

It really depends on your usecases and team experience/preferences - BUT, if you are truly open-ended about whatever stack, our personal experience was:
Scala + Scalatra + Jetty was simple and very fast.
Node + Express was surprisingly close in speed - but with the benefit (in our case) of flexible Javascript code.
Ruby was much less performant than either, but had cool code.
Scala was a winner because our shop has lots of experience in the JVM.
Hoever, we hope to leverage node more in the future do to the simplicity.
I'm sure experienced Ruby guys could do improve and tune things, but it wasn't worth the learning-curve for us and a non-starter.

Check out spray -- I like it because it is lightweight and well-designed (modular, asynchronous, sane API). For web service stuff most web frameworks just come with too much baggage.

Related

Frameworks with automatic admin interface and login [closed]

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 like to experiment with different languages to keep my interest alive when working on small side projects away from my day job.
I'm finding it increasingly difficult to steer away from Django and Ruby on Rails because of a couple of features they come packed with (or that are mostly default and easily integrated): authentication and automatic admin interface. Django comes with both, with Rails you just have to add ActiveAdmin as a gem and you're ready to go.
When I try to experiment with different frameworks and languages (Noir for Clojure, Express for Node), most of the times I find interesting languages I'd love to work with but whose "web framework" idea is just some convenience method for routing and parsing URLs and requests, leaving you alone with all the common and annoying parts of web development, like form validation, user authentication and profiling, having a working admin interface and so on, all things that Django and RoR provide to you for free.
What other languages and frameworks have such commodities? I'm aware of some PHP frameworks like Symfony, but I really have used PHP for too long in pas years and I'm pretty fed of it. Thanks.
Stick with RoR in my opinion. It's still a young yet powerful framework. It's well maintained and quickly plugged whenever a security risk becomes known.
It doesn't really matter what kind of MVC framework you use since it all comes down to the programmer. Ruby on Rails cuts out the painful part of programming (IMO) and allows you to do the enjoyable parts. Requiring knowledge of SQL is very minimal within Rails unless you're doing complicated scoping.
If I kept searching around for different languages to explore after I found one that suited all of my needs and then some, I would never get anything done. Moving from PHP/CakePHP to Rails is definitely an upgrade in my opinion, but at this point, you're better off committing to one language (Python/Django or Ruby/Rails).
I would stick with Django. Having worked in everything from classic ASP, ASP.NET, ASP.NET MVC, Java, PHP and Rails, I can state, unequivocally that Django is hands-down the easiest to work with, most profitable framework I've ever used.
Rails does have some pretty controllers, but it pales in comparison when you get down to functionality. Sure, Rails has lots of plugins, but Django has nearly everything you need under one roof. Django-admin alone is a friggin' gold mine. I work full-time as a Technical Architect, but also own my own business. Switching from Rails to Django in 2008 was the single best thing I ever did for my business.
If you want something flexible, modular, easy-to-extend and incredibly well documented - Django is your ticket. You also see far, far fewer of these lovely posts with Django.

ASP MVC, Django or Rails? [closed]

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 12 years ago.
I've to start my master thesis project and I've to choose a technology to work with. I've used Rails and ASP MVC, in two projects, but never used Django, only some play with it. But I've some experience with python and really like the admin interface.
The objective of my master thesis is a creation of portal to a public hospital.
I have several years of experience with .NET and C#, but the other alternatives are appealing too.
In terms of philosophy, all three are open-source, and ASP MVC works in Mono.
What are your opinion?
UPDATE 1: By your opinion, I mean share your experiences(good and bad), advantages, disadvantages with this frameworks.
UPDATE 2: Btw the portal will be used by the patients or potential patients...
Thanks
IMO the only reason to consider .net is if the hospital deploys on windows. Deploying anything else on windows is a pain, and deploying .net on any other platform is a pain. (IMO)
Beyond that, I think the best thing to do was get a rough idea of what you want the portal to do, then look at library support.
After that, its just really what language do you prefer.
UPDATE:
As for my experiences on each: I have 4 years of webforms experience, and played around with MVC. Pluses are that it is mind rendingly fast, and the deploy experience is pretty damn simple. Tooling is decent too, especially the SQL Server frontend, never seen another db tool as good. Down side is that it just doesn't do as much for you as django or rails, in fact, it doesn't really come close. Also, you are going to have to type 3-4x as much due to the language, although some people think the tools make up for the verbosity.
For rails, I have about 8 months professional experience with it. Plus side is there is a plugin for almost everything, and the framework is pretty packed with things that make your life easier. Personally, ruby is also my favorite imperative language, its the kind of thing where you achieve multiple levels of enlightenment as your knowledge of the platform deepens. Down side is that we are in the middle of a transitional period right now in both rails and ruby, so documentation, recommendations, and library support is probably going to be up in the air for the next 8 months or so.
Finally, I am really not an expert on python or django, but I have played around with both. The language is very similar to ruby (meant for productivity over perf, dynamic, very elegant design), but differs quite strongly in philosophy. Pythonistas believe there should be one (and only one) clear and concise way to do things. Rubyists (like perl monks) believe that there should be many nuanced ways of doing something, and that elegant code is like elegant language; expressiveness is paramount.
I would say rails has an edge over django at the moment, due to more eyeballs over a greater period of time. That wont last forever though, django is wildly popular and in a few years I am sure support for both frameworks will be roughly equal. It really comes down to a philosophy thing with these two platforms. If you look at a library that pushes the language in some strange directions that take awhile to grok, but once you do you realize is quite an elegant way to do things, chances are you are a ruby guy. If you look at something like that and say "Ok, so thats clever, but they really should have done it the way that everyone else does it, cause non standard use of syntax really sticks in my craw", chances are you are a python guy.
I think that is totally up to you. In this case, everyone else opinion seems useless.
According what you say, there is no technology limitation and you are totally free to chose anything you want. It's impossible to find an objective criteria.
It would depend if you're more interested on improving your ASP NET / C# skills and giving MVC a try or if you want to learn something totally new.
Any of those options is correct, it depends on your taste which one to pick.

Lua as a web language [closed]

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'm building a new game and I need to build a web app to help manage content generation. The app would consist of a couple simple forms that would tie into a MySQL db.
I've been really interested in learning Lua for a long time due to it's large popularity in the video game industry and was wondering how well it works as a server side language. I could easily write the web app in PHP but I'd rather use this opportunity to learn Lua if it makes sense.
What do you all think?
Cheers,
Sure it can be done. Good idea if you just want to learn Lua. You should start here: http://www.keplerproject.org/
Of course, if your app would consist of a couple simple forms, you can use all what you want. But if it is more complex (will become more complex in future) it will be better to use some industry standard languages like Python or Ruby (or, at least PHP), there are a lot of good frameworks writen in them that very simplify your work (I don't know about any complete lua web frameworks) .
You should remember, that in future other people will have to maintain your code and there are very few web-developers who know Lua.
Probably, there will be problems with documentation and basic libraries too.
While LUA is a nice language for embedded development but i would extremely vote against LUA for web development.
The reason is that in Games you simply don't have an external API. All is done with your own objects only some calls into your game engine.
But the web world is so full of stuff you need, like SMTP, POP3, IMAP, SSL, Amazon APIs, Google APIs, RSS Apis, Imaging etc. and while the checklist for LUA may have a check mark behind all this words - it doesn't mean anything. Most of the stuff i have seen is just a "me too| implementation but not industrial strength. They are projects by hobbyists and are published on a "Its good enough for me" basis which is total unacceptable if you ever go mission critical.
There is a reason why it takes years and a huge community to get this up. Lua has an extremely small community of web developers.
So if this is a professional project where you put your money i can only say hands off. On the other side if you have enough money i still have some snake oil here for sale, please contact me.
I have been using lua for years as a web language. Initially using the Xavante project and more recently apache2.
Dont listen to any neigh sayers, its a great language for web developement and we use it to write business software, and not just for form processing, for graphical applications too.
Also it offers us seamless integration to any other lua or system functions we might need to call.
Good Luck!
Have a look at Nanoki which is built on a pretty minimal set of libraries (lfs, luasocket, lzlib, slncrypto)
and Sputnik which is built on Xavante or CGI
Lua is a good language but it is best suited to embedding within an existing project in order to quickly extend the capabilities of that project. In particular, the interesting aspect comes with how you bind it to the host application. This is definitely the case when programming for games where it is an embedded language rather than the language the whole app tends to be written in. So using a web app to learn about Lua with a view to making games is probably not a very good approach, especially since the syntax is very simple and would be picked up quite quickly anyway.
I think that specific variants of lua can be used successfully for web applications and I have done that in the past using the maintained weblibrary. It can depend on if the lower level software on the computer is itself written in lua because of its high speed and this may cause a clash of lua versions. Regarding a serverside possibility the server would need a compatible version of the script developing facility for the hardware and a suitable bytecode or VM instructions and custom VM runtime implementation for running the application.
I've been developing a pure Lua Web Server, you could always check it out and see if it suits your needs
Lua4Web https://github.com/schme16/Lua4Web

clojure vs. Ruby [closed]

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 12 years ago.
I'm ASP.NET developer. I want to learn web development technologies and other languages than Microsofts.
I heard about two languages but I don't know which one is better or how to favor one over the other especially that clojure is new somehow.
Could anyone help me about why to choose one of them over the other?.
Thanks.
Ruby will obviously give you a better bang for your buck if your aim is to get things done and to reuse mature libraries. It must have one of the most vibrant ecosystem considering web development. The quantity of new stuff is big and, most importantly, the quality is often amazing.
It has a very nice package distribution system, and a number of tools which makes practical web development a breeze, at all levels.
In the heavyweights web frameworks you have:
Rails, which you have necessarily heard about. It is probably one of the best compromise today between big community and intelligent design. The other one would be django in my opinion but it is a python framework
Merb, which is a lighter alternative in the full blown framework department
And you have a ton of lighter ones, like Sinatra , which is probably one of the most elegant small web framework i have ever seen, or Camping, which is small and very fun to use.
This is only the beginning. Be it for ORMs, templating engines, or anything else you'd want to do with it web related, you have a ton of quality options.
On the negative side for ruby:
It is a very dense language, with a lot of things to learn, and a distinct inclination for "magic" constructs. It is quite beautiful, but it is far from the simplest language.
It is slow. If you want to do anything that needs performance, ruby is probably not the language you need. That may or may not be a problem depending on what you want to do with it
It doesn't have as many library for "regular programming" than it has for web programming, although it is clearly not the desert either. A language like python has a more wide range of libraries if you step out of web programming though.
Clojure is a very different beast altogether. It is a very new language, and it is entirely functional. If you never programmed in a functional style before, it may be a paradigm shift that will make you less productive for a while, but you will almost certainly learn a lot in the process.
It is also a lisp, and like with functional programming, it will probably mean a lot of new things to learn, but a lot of enlightenment at the end of the process.
It is a very elegant language, with a very vibrant community. It is also a lot faster than ruby, and it is only getting better with the new 1.2 version.
So on the positive side :
It is a clever language. Contains a lot of interesting ideas, notably regarding concurrency. It is not object oriented
It's fast for a dynamic language
It runs on the JVM, and has a very strong and easy to use interop system with Java. That basically means you have the whole Java ecosystem to your disposal.
On the negative side :
It is very new. That is not a disadvantage in itself, but is the reason for other troubles you might have with it along the way.
It has very few well integrated and thought libraries. This is the point that is the most detrimental in my opinion. You basically have everything you will ever need in java world, but the solutions may be ugly. You might want to code your own wrapper library in the process, but this takes time.
It is not like everything you know. It's not object oriented, it is not imperative, and it hasn't anything like classical C syntax. So depending on your other language experiences, it might take a long time to learn
So the summary is :
If you want to learn new things in a very comfortable environnment while having the possibility to build things very fast by leveraging mature libraries, choose ruby.
If you want to learn even more new things, you don't mind in totally new territory, eventually taking more time to do things, and you want to participate to a community that might be on its way to modify the way we think about programming, while hacking and having fun in the process, choose clojure ;)
Switching from ASP to Ruby is probably easier than switching to Clojure, also it has a larger community and ecosystem. However, if you are interested in functional programming and/or fancy concurrency features, you should give Clojure a shot.
Ruby is a nice language though I'm partial to the Django framework over Rails. One thing that I have found working with interpreted languages is their ambiguous implementation of threads. In both Ruby and Python the interpreter will only crunch though one thread at a time.
As far as clojure goes, think about how big the library will be when you try to use it. Coming from .Net you already have a huge lib. Python and Ruby are fairly mature at this point, and you can find most any extensions you could imagine. It is so easy to take a big library for granted until you don't have it. Before switching look at .Net nuke. Haven't used it but it's supposed to be model/viewer layer for .Net.

QuickBooks vs. MYOB vs. PeachTree [closed]

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've been trying to choose between the three accounting software. However, I can't decide which one should I use. In terms of user interface, I would go for PeachTree and QuickBooks. MYOB seems too old IMHO. In terms of using for software development, I would go for QuickBooks because I think there are many developers using it and the SDK can be easily downloaded. Also, do these software support currencies aside from dollar? What SDK is easy to use for .NET development? TIA.
QuickBooks is very mature and much, much more popular than either other system. It's also much easier to find an accountant familiar with QuickBooks than it is to find an accountant familiar with either of the two others.
As far as development goes, QuickBooks has a reasonably strong developer community behind it, and integration/the SDK is pretty flexible. There is an official QuickBooks SDK that's pretty easy to use and is downloadable from Intuit's site. The forums are also a good resource:
https://idnforums.intuit.com/
To answer the question about SDK's (selecting an accounting package for everyday use is beyond the scope of this site), I've used both Quickbooks and Peachtree; I don't know anything about MYOB. Here we go.
Quickbooks:
A lot of stuff is hidden by the COM interfaces, so you end up having to do tricky type casts that you have to look up in the documentation. And since you'll be doing this every time you unwind a results list, it happens quite frequently.
It's confusing at first because the framework is actually quite powerful in terms of result filtering. This, coupled with the previous point, makes getting started a little difficult.
The documentation is not the greatest, but is more or less complete. Some of the examples are convoluted and unhelpful, but most of the time you can get what you need from them.
Actually connecting to Quickbooks is quite slow. The API lets you aggregate requests (i.e., on one call, you can query customers and items at the same time) which helps out a little bit.
There are a lot of little quirks in the API
The API is interface-centric
There are some features in Quickbooks that are implemented much differently than in other accounting packages. These things show through in the API, which in turn makes it more difficult to write code. Sometimes it makes sense, sometimes it doesn't.
Peachtree:
Connecting and querying is very fast, but involved queries (such as invoices) are very very slow, even when only a single field is returned.
Results come back in XML, so it's not as automatic as having things come back in .NET objects, but at least it's easy to process. Some of the XML structures are a bit bonkers (attributes attached to the wrong element), but processing that isn't a huge deal.
The documentation (a single Word document) is pretty bad, and the developer community is essentially under lock and key (you have to be a partner with Sage, i.e., $$$, to get access to their online forums). Googling "Peachtree SDK"-anything returns zero useful results.
The API is enum-centric, and the enums aren't documented very well. API classes and interfaces are named poorly (no I-prefixed interfaces) such that name collisions are likely... so you'll have to alias the API namespace in most cases. The enum names themselves are unbelievably long. Sometimes it takes 2 lines to specify a single enum value, which is unbelievably messy and annoying (example, without namespace alias: PeachwIEObjCustomerListFilter.peachwIEObjCustomerListFilter_CustomerName).
Result filtering isn't as powerful as Quickbooks, and in fact I'm struggling to get it to work at all (with an example lifted directly from the docs) is essentially useless.
From what I've read, API support is less than stellar (it seems like Sage aren't really developing it any more, and they may possibly be phasing out Peachtree altogether)
The implementation is less complete than Quickbooks
Both APIs have their strengths and weaknesses... I couldn't really give any kind of recommendation for either without knowing what type of application you're targeting, and how extensive your needs are.
I use MYOB as the main accounting package for a law firm employing 10 people. The program integrates with another package we have to use for statutory Trust accounting. Of the two programs, MYOB is noticeably superior. It is easier to use and is extremely robust and reliable. I have not used Peachtree or Quickbooks but rate MYOB as 9/10 and would be reluctant to change.

Resources