Jump to content
Sign in to follow this  
teodora

What are you working on? - node.js

Recommended Posts

We have a few hundred Linux servers connecting to our main server via ssh tunnels. Our reverse proxy is currently written in PHP, gonna be re-writing it in node.js.

Share this post


Link to post
Share on other sites

We have a few hundred Linux servers connecting to our main server via ssh tunnels. Our reverse proxy is currently written in PHP, gonna be re-writing it in node.js.

 

Why? Are there performance advantages to doing this or something? Not a dig, just interested :)

Share this post


Link to post
Share on other sites

Well our PHP proxy is very slow due to limitations on how our old product was coded, so we had to do two curl requests per page load rather then just the one.

 

We could re-code it in PHP and there would not be much difference speed wise, but as we will be moving most of our web development over to node in the future so we can start using sockets we thought it be bets to start using it sooner rather then later.

 

I could make it in PHP and run a few benchmark tests and compare the results but as it is just bacicly a curl request i cant see there being much diffrence

Share this post


Link to post
Share on other sites

Well our PHP proxy is very slow due to limitations on how our old product was coded, so we had to do two curl requests per page load rather then just the one.

 

We could re-code it in PHP and there would not be much difference speed wise, but as we will be moving most of our web development over to node in the future so we can start using sockets we thought it be bets to start using it sooner rather then later.

 

I could make it in PHP and run a few benchmark tests and compare the results but as it is just bacicly a curl request i cant see there being much diffrence

 

I feel an experiment coming on? ;)

Share this post


Link to post
Share on other sites

The main reason I started learning node.js was speed. There's a php app I made, which I re-coded in js and node, using socket.io and the speed is amazing! The node app outperforms php big time - approx. 5-6 time faster.

Share this post


Link to post
Share on other sites

Oh yea ATM our software polls php scripts up to 3 times a second (this is the worst case) we have plans to move any ajax polling over to sockets as its just alot more quicker, plus when you want to turn a light on or turn your boilers on there is not a slight 1 second lag.

 

One thing about speed when we bench marked selecting data from both MsSQL/MySQL databases (1k, 25k, 100k, 500k, 1m records at a time) node.js was alot slower almost 2 times slower then php. But this was using an ARM chipset not intel (im told by a colleague that it makes a diffrence).

Share this post


Link to post
Share on other sites

The main reason I started learning node.js was speed. There's a php app I made, which I re-coded in js and node, using socket.io and the speed is amazing! The node app outperforms php big time - approx. 5-6 time faster.

 

What's your app? I've been doing some work playing around with Node, Socket.io, and the REDIS db, also been toying with the idea of using localStorage API for data as kind of a cookie replacement, to further improve speed of persistant data.

I ask because my main issue now is thinking of a fun idea for an app that is different to the typical chat servers & to do list systems...

Edited by rbrtsmith

Share this post


Link to post
Share on other sites

 

What's your app? I've been doing some work playing around with Node, Socket.io, and the REDIS db, also been toying with the idea of using localStorage API for data as kind of a cookie replacement, to further improve speed of persistant data.

I ask because my main issue now is thinking of a fun idea for an app that is different to the typical chat servers & to do list systems...

 

I'll PM you :)

Share this post


Link to post
Share on other sites

I should also add that I've noticed with a lot of things related to Node - many are not supported on windows. This backs up my statement that windows is not the best option for developers on this thread: http://www.webdesignerforum.co.uk/topic/82679-bootstrap-dreamweaver-problem/?hl=windows&do=findComment&comment=491911

 

Here's the DB I was just about to install on my windows machine. Look like it's gonna take some extra leg-work. http://redis.io/download

Share this post


Link to post
Share on other sites

I haven't got to working with DB & node yet, but I gather Mongo DB is quite popular? I also came accross Redis a lot.

 

From what I've read mogoDB is easier on beginners and those who need to build an app fast, Redis is more about high performance, but requires more time and planning to set up. I've read Redis can be 2-3+ times faster than mongo DB. But don't forget we have LocalStorage and SQL built into modern browsers so it's worth looking into storing some data there for lightning fast performance. I don't know enough about it all to know what should be stored where and in which circumstances, that I plan to learn :)

Share this post


Link to post
Share on other sites

LocalStorage and SQL sound interesting, I should read about those :) There was a nice tutorial on how to setup app with MongoDB which looked easy enough, I haven't had a look in detail at anything Redis related yet.

 

Look what I found on node and MySQL - http://codeforgeek.com/2015/01/nodejs-mysql-tutorial/ looks useful if your setup requires MySQL.

 

Stupid question #1 - does this mean you can setup node and php to use the same database?

Share this post


Link to post
Share on other sites

I'm not sure. But I prefer the look of NoSql right now, primarilly because it's very similar to JSON which is a great data format. I haven't read enough into things to see the full pro's and cons. I'm not sure how the two compare for speed but NoSql databases seem to be getting plenty of attention from the Node community.

 

LocalStorage is really easy, there's just get and set commands for key:value pairs, very similar to JavaScript objects. You can see them if you open your Chrome Dev tools and open the resources tab, you will see these in the list on the left:

Web SQL

IndexedDB ??

LocalStorage

SessionStorage

etc..

 

Local and Session storage are the same apart from the data is lost from session storage when a user leaves the application. LocalStorage is saved until a user removes their browser history (and possibly a hard refresh, not 100% sure on that).

Bearing these things in mind I wouldn't store anything substatial here, but we can see that certain things can be sped up by these rather than using the database.. OR:

Check if the key is found in local storage -> return the value. else -> look it up in the database.

Edited by rbrtsmith

Share this post


Link to post
Share on other sites

I'm not sure whether this adds anything or not, but I recently created an iOS App that I built with HTML, CSS, JS and phonegap. I used PouchDB to keep a couchdb database on a server in sync with the device's built in nosql database. Was a bit of a learning curve for a phonegap, couchdb and pouchdb newbie but it turned out okay :)

Edited by NOCK

Share this post


Link to post
Share on other sites

Started work on replacing my LAMPP server with a node server got all of the domains working, now i just have to port a few projects over (luckily noting major 95% of it is HTML/CSS).

 

I have a few mates that have small businesses, so i may help them out with a website just so i can speed up the learning process :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Recently Browsing

    No registered users viewing this page.

  • Member Statistics

    • Total Members
      57,712
    • Most Online
      4,970

    Newest Member
    adabo
    Joined
  • Forum Statistics

    • Total Topics
      65,782
    • Total Posts
      454,601
×