News for hackers. Stuff that matters.
Re:Going Serverless: Migrating an Express App to AWS API Gat... by twagner on Tuesday October 11, 2016 @05:41AM (#12682799)
@hobofan, take a look at our recent API Gateway features and see if the greedy paths and pass-through settings provide what you're looking for (they're also supported by CloudFormation). We tried to simplify the "configure every route" problem, but always looking for additional suggestions to make API config easier.

@jomamaxx (& others): Reducing latency (and latency variability) is a critical goal for our team. We've improved p99 variability in API Gateway-related latency over the last few months, and will be addressing some of the Lambda-related latency that occurs when we refresh containers in the coming months. Additional latency optimizations coming at all levels of the stack, including networking.

A clarification on the discussions about "managed hosting": Lambda is not classic web hosting; in fact, we block Lambda functions from calling socket.listen. In the Lambda model (whatever you prefer to call the broader category), the cloud service sees every request in order to perform scaling and load balancing on the function's behalf.

Happy to chat offline with anyone who has additional questions or feedback: DM me on twitter @timallenwagner

Re:Going Serverless: Migrating an Express App to AWS API Gat... by scrollaway on Tuesday October 11, 2016 @05:55AM (#12682844)
Tim, when are we getting Python 3 support on Lambda?

Being stuck on 2.7 has been the greatest source of issues and the #1 problem we have with Lambda. If Google/Microsoft came out today with Python 3 support in their Lambda competitor, we'd move in an instant.

Re:Going Serverless: Migrating an Express App to AWS API Gat... by rurounijones on Tuesday October 11, 2016 @07:24AM (#12683299)
Piggybacking above comment with "Wheres da Ruby?" :D Using shims or jruby (with slow startup wasting milliseconds) hurts.
Re:Going Serverless: Migrating an Express App to AWS API Gat... by noobiemcfoob on Tuesday October 11, 2016 @10:38AM (#12684766)
I'm in the same boat. We're developing a new product with no real reason to stay on Python 2, besides Lambda. Python 3 support would make my life so much easier.
Re:Going Serverless: Migrating an Express App to AWS API Gat... by twagner on Wednesday October 19, 2016 @07:43PM (#12748714)
Yep, I hear about the lack of Python3 all the time, and I know our Python users are waiting for it. On the roadmap, and partially complete, but competing with some other language work at the moment.
Re:Going Serverless: Migrating an Express App to AWS API Gat... by cerebrum on Tuesday October 11, 2016 @08:46AM (#12683822)
I would want to know, how do I manage user credentials in AWS lambda. Lambdas are stateless, there is no session, so how do I keep track of which user is executing the current lambda?
Re:Going Serverless: Migrating an Express App to AWS API Gat... by brianwawok on Tuesday October 11, 2016 @08:59AM (#12683915)
How do you do it with a load balanced stateless web server? People have been doing this 10 years, most language should have some frameworks or plugins around it....

Common is to give the client a cookie with a session id (KJASDJKASDASDS) in a cookie. Then in a RDBMS you store this (session KJASDJKASDASDS = User 1234)... and the first part of each web (or lambda call), you go look up the user by session and know who it is.

(You can also store the user ID directly in an encrypted cookie, but that has a few other problems)

Re:Going Serverless: Migrating an Express App to AWS API Gat... by cerebrum on Tuesday October 11, 2016 @09:05AM (#12683975)
Thanks for the reply. In which DB should I store this data, considering the option of either DynamoDB or ElastiCache?
Re:Going Serverless: Migrating an Express App to AWS API Gat... by brianwawok on Tuesday October 11, 2016 @09:06AM (#12683986)
Why not MySQL or PostgreSQL? Any reason you can't be relational?
Re:Going Serverless: Migrating an Express App to AWS API Gat... by Roodgorf on Tuesday October 11, 2016 @09:59AM (#12684385)
Just curious, what would be the major drawbacks of not using relational here? My understanding is that AWS is pushing Dynamo quite a bit and it seems cheaper, so if they're only needing to query off of session id and maybe user id, shouldn't that be sufficient?
Re:Going Serverless: Migrating an Express App to AWS API Gat... by brianwawok on Tuesday October 11, 2016 @10:37AM (#12684754)
Relational is super handy. Very easy to report on and do various things down the road.

If all he needed was session id, sure, NoSQL is more or less the same. But what about when he adds other fields that are related? Say customer address or reports or .... His life may very well be easier with relational.

You should generally start relational. Then branch out if you are hitting the brick walls of relational. People using NoSQL for a 100MB database are making their life SERIOUSLY more difficult than it needs to be. (I have done it before, not fun).

Re:Going Serverless: Migrating an Express App to AWS API Gat... by cerebrum on Wednesday October 12, 2016 @08:39AM (#12692257)
> You should generally start relational.

I don't know if it is that easy to scale once you realize that the demand is growing, see my other reply here:

https://news.ycombinator.com/item?id=12692234

Re:Going Serverless: Migrating an Express App to AWS API Gat... by cerebrum on Tuesday October 11, 2016 @09:10AM (#12684014)
Because I don't want to manage my own DB, so I would rather stick with the options that Amazon offers as a service.
Re:Going Serverless: Migrating an Express App to AWS API Gat... by brianwawok on Tuesday October 11, 2016 @09:21AM (#12684099)
You realized Amazon offers hosted MySQL and PostgreSQL, right? One click, and it's up.

https://aws.amazon.com/rds/

Re:Going Serverless: Migrating an Express App to AWS API Gat... by cerebrum on Tuesday October 11, 2016 @09:36AM (#12684204)
Ok, I want a 2 pronged approach:

1) A NoSQL DB for the main data providing replication and scalability(e.g. Cassandra or DynamoDB).

2) Another DB for quick access and transient Data where replication is not so important, e.g. storing the session cookie. Relational vs Non-relational would not be an issue since I'm only storing very little data here and want fast access and minimize costs(in DynamoDB you still have to pay per operation). Therefore I'm looking for some simple solution like ElastiCache.

Re:Going Serverless: Migrating an Express App to AWS API Gat... by brianwawok on Tuesday October 11, 2016 @10:35AM (#12684723)
How much data are you going to have, and of what format? Do you actually need NoSQL here?
Re:Going Serverless: Migrating an Express App to AWS API Gat... by cerebrum on Wednesday October 12, 2016 @08:35AM (#12692234)
I'm doing a social networking site, so I don't know how much data I will end up with. My reasoning was as follows:

1) The data model is rather simple, basically one table with the user data(name, location, age, etc...) and some images. So it shouldn't be too difficult to do this with NoSql as opposed to SQL. Yes, simpler with SQL but not significantly so.

2) If I ever need to scale, I'd rather make the right choice from the beginning(NoSQL) so as not to need a migration later.

3) In any case NoSQL would be a learning experience for me, so another plus.

If there is a mistake in my reasoning I would be grateful for any one pointing it out.

Re:Going Serverless: Migrating an Express App to AWS API Gat... by aikah on Tuesday October 11, 2016 @08:14AM (#12683607)
The point is "serverless" is a sham. Your clients still need to rely on another service API Gateway to communicate with the outside world. So stop with this stupid marketing.

Your are selling a basic pubsub architecture as something "innovative" when the only real innovation is the pricing. That's the exact definition of marketing, and at the same time you are making the community of web developers sound like idiots that don't understand what a server is. You can make plenty of money without being missleading, why do you feel the need to use a misleading language ?

There is a server, period.

Re:Going Serverless: Migrating an Express App to AWS API Gat... by le-mark on Tuesday October 11, 2016 @08:25AM (#12683680)
Of course there's a server, or do you think you're the only genius in the room who understands client server communication? "Serverless" is a legitimate phrase to describe a growing phenomenon. Most reasonable people read "serverless" as "server I don't have to admin", not "there is no server". No one wants to read your pedantic bloviating, get over it!
Re:Going Serverless: Migrating an Express App to AWS API Gat... by aikah on Tuesday October 11, 2016 @08:27AM (#12683699)
> Most reasonable people read "serverless" as "server I don't have to admin"

Most reasonable people find the "serverless" moniker obnoxious to begin with. If something doesn't require administration then call it "adminless", not "serverless"

Re:Going Serverless: Migrating an Express App to AWS API Gat... by marktangotango on Tuesday October 11, 2016 @08:34AM (#12683744)
As others have said, serverless applies to the pricing model, in which it makes perfect sense, imo.
Re:Going Serverless: Migrating an Express App to AWS API Gat... by aikah on Tuesday October 11, 2016 @08:51AM (#12683867)
Yes we agree that "serverless" is pure marketing. as I already said.

> Your are selling a basic pubsub architecture as something "innovative" when the only real innovation is the pricing.