Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Mojolicious::Lite: Should i use the build-in web server?

by karlgoethebier (Abbot)
on May 09, 2014 at 13:42 UTC ( [id://1085583]=perlquestion: print w/replies, xml ) Need Help??

karlgoethebier has asked for the wisdom of the Perl Monks concerning the following question:

Hi all,

I've build some web applications using MSSQL, IIS7, PHP/Perl and Flex.

The applications are for 10-100 concurrent users.

Each Every HTTPService component in my clients has a corresponding PHP file containing the code for XML serialization.

And for each every PHP file there is a corresponding Stored Procedure in the database.

I've got up to 50 each.

There are also some Perl scripts for administrative task - only for a few users.

I would like to get rid of this MSSQL, IIS7, PHP stuff in the next project.

So i considered using Mojolicious::Lite in an Linux environment.

In the Mojolicious docs i read:

"Mojolicious contains a very portable non-blocking I/O HTTP and WebSocket server...is solid and fast enough for small to mid sized applications."

I think my applications are mid sized but i've got no experience using Mojolicious.

So i'm unsure if the built-in web server is the right choice for me.

Thank you very much for any hint and best regards, Karl

«The Crux of the Biscuit is the Apostrophe»

  • Comment on Mojolicious::Lite: Should i use the build-in web server?

Replies are listed 'Best First'.
Re: Mojolicious::Lite: Should i use the build-in web server?
by Your Mother (Archbishop) on May 09, 2014 at 16:17 UTC

    I would recommend looking into uWSGI. I have only used it a little but found it to be far more stable and performant than all the current Perl application server backends and as full-featured as any. It’s got a PSGI compatibility layer that you’ll need to include when you build it and run apps under it. Any of the new gen frameworks will work out of the box with it (need config and proxy/port strategy and probably want a static server in front—I recommend nginx though I guess you’ve already made your choice there). Any older stuff, even CGI, could be adapted pretty easily with PSGI/Plack shims and middleware.

      Thank you very much Your Mother for answering.

      I didn't know uWSGI but i think i'll give it a try.

      My best regards, Karl

      «The Crux of the Biscuit is the Apostrophe»

Re: Mojolicious::Lite: Should i use the build-in web server?
by InfiniteSilence (Curate) on May 09, 2014 at 16:20 UTC

    Answer: Set up a test server somewhere in your environment and try it.

    Over the years I've gotten questions like this mainly from business types so it is surprising to hear it from a developer. How do you know what a Toyota SUV is better than one from Hyundai? Test drive and and scout for performance data.

    Set up a list of requirements and cross out everything that the tool does and highlight anything that it does not (sometimes called a gap analysis). Evaluate how difficult it will be to add the things that it lacks. Try again with different toolkits. When you run into a more specific problem, post here again.

    Celebrate Intellectual Diversity

      InfiniteSilence,

      Normally I would agree with your response, but occasionally asking for the wisdom of someone who has done this(or that) before, can save hours/days/weeks/months of frustration. I have many times spend large amounts of time to then give up on that *solution*.

      Now on the other hand, driving a new SUV sounds like having some fun and I would definitely go for that solution.

      Regards...Ed

      "Well done is better than well said." - Benjamin Franklin

      "How do you know what a Toyota SUV is better than one from Hyundai?..."

      I don't know. But before i test drive one, i would ask my friends.

      Even when i buy an expensive bottle of wine i first ask a fellow: "Did you try this stuff? Do you think it's worth the money? And did you like it? Or got you heartburn from it?"

      Sorry for that old school approach but i consider this as good practice.

      BTW, i really hate SUVs ;-)

      Thank you very much for answering and best regards, Karl

      «The Crux of the Biscuit is the Apostrophe»

Re: Mojolicious::Lite: Should i use the build-in web server?
by Pizentios (Scribe) on May 09, 2014 at 20:46 UTC

    I've had a great experience using hypnotoad and nginx for serving up our Mojolicious apps here at work. It would be hard to tell you if ~your~ application is going to run like you want/expect as we have no idea of what your application does....clearly some things take more resources to do than others.

    My most recent project is based on a software stack that includes: postgres, postgis, mapserver, openlayers...with a mojolicious perl backend served up with nginx/hypnotoad. It runs fantastic with a heavy user load.

    I'll i can tell you is that your likely going to have to give it a try and see if it meets your expectations.

    -Pizentios

      Thank you very much Pizentios for your advice. I'll give it a try.

      "...as we have no idea of what your application does..."

      Briefly, it's just about tracking some business processes:

      • Import some data (CSV or Excel files from various sources AKA departments)
      • There are about 1000 records every day
      • Every record should have a status
      • If a record is "imported" (or initial) status is 0
      • If the process is finished status is "solved"
      • Status is from 0 up to ~50
      • That means: "initial", "phoned customer", "emailed customer", "sent snail mail to customer"... "you didn't pay - go to jail"..."solved"
      • If the data matches some criterion (on import), status should be updated automatically
      • Sometimes the operators need to update status manually
      • Sometimes the operators need to add some comments to the records
      • If some status is reached, the data is to be exported as CSV or Excel file for further processing by the next department
      • Every record needs to be "checked out" by it's operator and marked as "locked"
      • If a record is "checked out" and marked as "locked" it should be visible to the other operators but not editable
      • There is a need for some "role concept" (from "read-only" up to do "everything")

      I described the software stack i use :-)

      Best regards, Karl

      «The Crux of the Biscuit is the Apostrophe»

        Sounds to me like perl and mojolicious would handle your processes just fine.....and do it fast. I have done many projects that involved processing csv files doing something with the data and then saving to a database or another format. I have found that perl does this type of thing very well. There are many modules in cpan for working with csv/excel.

        Mojolicious has plugins to get you running with roles very quickly as well (ie: operator status etc)...https://metacpan.org/pod/Mojolicious::Plugin::Authorization comes to mind. Good luck and i hope you enjoy the framework as much as i do.

        -Pizentios

        I use a stack made of Apache/Mod_perl/Postgres that I find very versatile; there are options to use nginx instead of Apache, and of course many databases through DBI.pm

        All of what you describe could be done with a couple modules in Perl that query some tables in a database and generate a few lines of html. Since you know Perl already, the initial learning curve for mod_perl does not seem huge.

        I'm not sure what a framework brings you over this in your case?



        libremen.com : legal case, contract and insurance claim management software
Re: Mojolicious::Lite: Should i use the build-in web server?
by neilwatson (Priest) on May 14, 2014 at 13:28 UTC

    I have an open source project, Delta Reporting that uses Mojolicious and Hypnotoad. We have less than 10 concurrent connections in use so far, but we've been happy with it. Mojolicious is simple to get going. I had a prototype application up in a weekend, and I'm not an experienced web programmer. As has been suggested, you should load test it for yourself.

    Neil Watson
    watson-wilson.ca

      Thank you very much for the hint neilwatson.

      Best regards, Karl

      «The Crux of the Biscuit is the Apostrophe»

Re: Mojolicious::Lite: Should i use the build-in web server?
by sundialsvc4 (Abbot) on May 10, 2014 at 11:54 UTC

    You do not give enough detail in your original post to help us judge whether the (radically different) approach that you propose to use here, really makes business sense.   Which is not a point-of-view anything like programming.

    Mere repetition ... even 50 or 100 times over ... is not necessarily a bad thing, especially if some of the PHP and/or some of the stored procedure code is not exactly the same.   (Did you, yourself, write 100% of this stuff?)   Nor does it matter that PHP was used ... it is a programming-language, as is a stored procedure.   What you get for your repetition in this case is a complete lack of coupling between all 50 instances of a system that, right now, is known to meet the needs of 50-100 users.   If either of these two programming-driven components, within any of these “repeated” food-chains, does something that is not exactly like every single one of the others, then your present approach can do that without disruption.   And-d-d-d-dd... it runs on Windows.

    You might say that it sucks.   But you’re the only one who has to see that.   50-100 other people see that it runs.   No matter what the Marketing Department introduces to us as its next must-have requirement, all we have to do now is to set up the 51st set of files, initially based on the 50th.   There is a lot to be said for being able to do such a thing, and in about an hour.

    Okay, so you want to learn Mojolicious (did you do a selective comparison or – just asking a fair and very-relevant question – did you pick that one out of a hat?), and Linux.   Grok that.   But if this be the case, then I’d suggest that you start by building the Mojolicious example-app on a virtual-machine that runs Linux, and to reconsider your options for any future work only after doing all that.   Don’t shack-up a future business requirement to it.   Not yet, anyway.   (Try running Perl and Mojolicious in the Windows environment, too.   It works.)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1085583]
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (7)
As of 2024-04-23 12:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found