Better HN
topnewbestaskshowjobs
Log inSign up

SomeCallMeTim

4,107 karma · joined Feb 17, 2010 (16y ago) · 1,490 submissions

I'm a consulting software architect and freelance CTO. I come in and rescue small businesses from code disasters, and occasionally am given the chance to prevent the disasters to begin with. I also used to develop video games, and have pivoted that skill to gamification consulting.

https://coderescue.com

Submissions

comment 10y ago · link · parent

The web app version has a whole lot of features that the installed app doesn't:

* It takes up zero phone memory. Yes, this is still an issue on really cheap Android phones. [0]

* It takes up zero phone resources, unlike the Facebook app, which is known for slowing down your entire phone. [1]

* The messenger app wants to send me notifications about stupid things and collect personal data using its over-broad permissions. I don't trust Facebook, and I'm not a tinfoil hat type.

* I don't want another chat ecosystem in my life, but if someone does message me on Facebook, I'd like to be able to see it on my phone without having to install an idiotic, resource-sapping, spyware app.

I really, really don't want a "good" Facebook chat solution. People want to chat with me, they can use Skype, Google Hangouts, or Slack. Or just send me an email and we can talk on the phone.

[0] http://www.gsmarena.com/samsung_galaxy_core_prime-6716.php

[1] http://www.israelnationalnews.com/News/News.aspx/207468

comment 10y ago · link · parent

>If you want to champion for equality, start by removing gender identity from a person profession choice in life.

I 100% support this statement, and don't see how it contradicts anything else I said.

>The social status of a woman should not be determined by how feminine the job is

Also support, though with the caveat that (as you mentioned above) the concept of a job being "feminine" ideally wouldn't exist.

>nor should the social status of a man be determined by the wages he earn

Here in the US, at least, the social status of, well, just about everyone, is at least partly determined by the wages they earn.

I agree that this isn't ideal, and in particular no one should be judged for their income level. But in a capitalistic society it's hard to get away from that sentiment entirely. But it's an aspirational goal.

I certainly don't worship income level myself: I just turned down an opportunity to make mid-6-figures in a position where I'd be working with a good friend, and an awesome commute, almost entirely because the work I'd be doing wouldn't be what I'd want to be doing. Many of my friends are in the game industry, and they make much less than they'd be able to make as programmers in other industries, and their "social status" isn't negatively impacted, at least from my POV.

>Currently, the trend is the direct opposite and more professions is getting gender identity ingrained into the work culture than the year before.

I live in an area where hair stylists are frequently men (near Boulder, Colorado, but I've also lived near San Francisco) and engineers are frequently women, without either being criticized for it, so maybe the bubble around me is just more sane than the rest of the country. But TBH that's a large part of why I live here.

I think basic income is a necessary piece in the puzzle to allow people to really do what they want: If you're taking whatever job is available just to be able to live, then you'll take the job you hate the least. We'd still have to shift the culture to remove any stigma from taking a job atypical for a gender, but that's what I've been trying to do in my own personal interactions, including responding to posts here on HN.

comment 10y ago · link · parent

Your link is in Swedish? I assume that they're not talking about US statistics in it. Different cultures are going to have different cultural barriers to jobs; there will be some overlap, but it's not going to be the same. In India, for instance, there are almost equal numbers of women and men in IT-related fields. There are other issues there, but that's one of the starkest examples I know of.

There's a great US document here [1] that details a lot of the problem, at least here in the US. Nearly half of STEM occupations are computer related, and that's where women have some of the hardest time getting jobs (only 26.6% female). Another 32 percent are engineering occupations, where the numbers are even worse (only 13.2% female).

Many of the jobs you listed aren't dominated by one gender; in your list, except for "nurse", most either are low paying or don't post a significant barrier to entry to men.

More women want to be veterinarians? Good for them! I can't imagine being a male vet would encounter any cultural biases that would interfere with his ability to be comfortable in the job, so it's not equivalent. The word "veterinarian" or "vet" doesn't have a gender connotation for me (unlike "nurse", for instance), and while there may be more women at vet conferences than men, I don't see how that's a problem for them? Unless they're concerned about their perceived masculinity or something idiotic like that.

I personally had no inclination at all to go into a medical or legal career; if I'd been born female, would it be OK for me to have been coerced into taking a lower-paying job, menial or otherwise, because of the harassment and bias present in STEM jobs?

Computer-related jobs aren't the only option, but those are typically the options that are most accessible, in that they don't require a multi-year degree and professional certification. And yet computer related jobs are increasingly dominated by men for no valid reason; many of the jobs you enumerated are dominated by women because those are they jobs they can get.

And if a woman does want to drive a truck or operate heavy machinery, that should be OK too. If that means that the guys need to not post centerfolds all over the office, or make derogatory jokes about women, so be it. Any hiring restrictions should be based purely on actual physical needs ("must be able to lift 70lbs." for instance).

If you replace "Political Correctness" with "Treating Others With Respect," you get a better concept of what it is that matters about being "PC".

Citing examples of professions that have a lot of women means nothing when the discussion is about specific domains (STEM in particular) that frequently exclude, or at least are not welcoming to, women.

[1] http://www.census.gov/prod/2013pubs/acs-24.pdf

comment 10y ago · link · parent

> Power dynamics are fluid and contextual.

True, but a distraction. When you can have a black man graduate from a top university, well dressed, and yet pulled over, torn from a car, treated poorly and handcuffed -- all for being black and owning a car that made the cops think he might be a drug dealer, that seems even worse than privilege from money.

Fighting privilege as a result of wealth is another noble cause; the entire 99% movement was about that, as is Bernie Sanders' popularity. But its existence doesn't mean that other problems aren't worse.

I honestly don't like the statements on either side about the babies, so I'll just leave that one.

> > Helping groups isn't the same as discrimination. > It is. The only cases where it makes a difference are inherently zero sum or net negative, because if they weren't then the racial preference wouldn't have been necessary to reach the same outcome.

No, I'm not talking quotas, I'm talking extra education and being open to working with someone who doesn't look like you. There are cognitive biases that cause people to naturally want to work with people who look like themselves; making an extra effort to overcome that bias and honestly compare candidates is not, by any stretch, a bad thing.

It's only "net negative" if you think the whites who had all of the privilege somehow "deserved" the jobs that the potentially better minority or disadvantaged candidates could get with additional help and with mitigation of bias in hiring. I know that there are groups who feel that way (otherwise Trump wouldn't be where he is), but that kind of us-vs-them mentality is harmful.

comment 10y ago · link · parent

>Am I missing something in this picture, or discussing "female privilege" is one of those topics beyond the proverbial line in the sand?

Addressed that here. [1] Not sure why this is even a question, honestly. White privilege is a thing. There are circumstances where women have the advantage as well, but there are others where they clearly don't.

>It's a false dichotomy. It is actually both. And black men is not nearly 90% of US prison population - it's actually 37% [1] for males and 22% for females.

Sorry, you're correct, I mis-remembered the numbers. Only 32% are white males compared to 77% of the US population, though. Blacks and Hispanics are totally over-represented.

>Usually people called SJW and people actually suffering prejudice are very different people.

Yeah, duh. We are the only ones in the position to make change happen, because we're the ones with the awesome jobs who can be sure that the culture is open enough that people who don't traditionally work in tech (or in games in particular) can feel welcome to participate.

Do you think minorities standing around complaining about how hard they have it will work? Um, no, it hasn't. It takes people from the majority to speak up for the minority in order for change to happen.

>They just think that because they talk about privilege that somehow allows them to take "holier than thou" pose.

Projection much? [2] Striking an "attitude" or feeling better than someone is not even on the top ten of the list of motivations of anyone I know (myself included) who fights for people to be treated with respect. That is a common attitude expressed by groups throwing around "SJW" as an insult, however.

I went to a public university (first a two year, then four year), but yes, I'm white and live in the US. But the motivation I have to argue with people about this is 100% due to the fact that if all white privileged people ignore the problem, then it won't go away.

It's our ball game, and it's our responsibility make sure that others are invited, and that they have all the opportunities they need to compete. Otherwise we're being selfish jerks.

[1] https://news.ycombinator.com/item?id=11798905

[2] https://en.wikipedia.org/wiki/Psychological_projection

comment 10y ago · link · parent

>The video you gave clearly showed how white men and white women get treated with privilege, yet your conclusion is that its only men who are privileged? How does that work?

Being white is clearly privileged in both cases. I never "concluded" that "only" white men are privileged. My other example was meant to specifically trigger the strongest reaction when a black man was paired with the white woman.

The way women are disadvantaged falls in other domains -- like the ability to get jobs in (at least some, probably most) STEM fields. It's a more nuanced distinction.

> Ever been physically attacked by a customer who then goes to accuses you for being mentally sick because the profession you took (a story I read by a male midwife, 99% female to male ratio).

Other stereotypes and arbitrary restrictions placed on gender are bad too. Male nurses are making inroads into the occupation, though they're still a minority. [1] Oddly enough, the men on average made more money per hour than the women.

But the point is that something like 95% of occupations are either skewed toward men or balanced, and you have to go looking hard for any skewed toward women. And if you're looking for well paying jobs, the difference is even more stark. Pointing out the few examples where women have the advantage is roughly equivalent to the "separate but equal" arguments in support of black and white segregation.

>There was a study by someone I no longer recall that showed how industries that has a single dominating gender, typically tend to create a work culture that infuses gender identity of the dominating group. Those of the minority gender then have to choose between either assimilate into that culture or leave. How much of "cultural pressures" could be explained by just that theory, and which gender is then privileged?

Doesn't matter. It could all be explained by that theory, and it would still be important to break open the industries (on both sides -- male nursing and women in STEM) by changing the culture.

Yes it can be uncomfortable. But the fact that a guy can graduate as a software engineer can look at a $100k+ offer out of college, and he can know that the career will be welcoming and comfortable, where a woman graduating with the same degree will face "bro" culture in a lot of companies, and be forced to "assimilate" into that culture or be ostracized? That's simply not OK.

[1] http://www.cbsnews.com/news/number-of-male-us-nurses-triple-...

comment 10y ago · link · parent

> If you are white and male, for example, then you are seen as privileged because, statistically, white males have more wealth and power.

No. If you are white and male, you've experienced more invisible privilege than you realize. [1] It's not about wealth, but it is about power -- power over others.

Questions:

* White man says that black woman stole something from him. What will happen?

* White woman says that black man stole something from her. What will happen?

* Black man says that white woman stole something from him. What will happen?

* Black woman says that white man stole something from her. What will happen?

What were your honest, visceral, reactions to each of these statements? Were they all completely symmetric? I can tell you I've been working on balancing my own feelings about various races, and I can't claim my own thoughts were completely unbiased. And I have been trying for years to purge the bias.

There's an awesome video of three college-student-aged in a park. All three are obviously trying to steal a bike. They picked three actors and dressed them roughly equivalently. [2] Watch the video if you want to be shocked, or just read my summary if you can't be bothered:

* White Actor: Everyone ignores him or asks him what he's doing. He gives dodgy answers, but people wish him "good luck" or leave the scene. Some say they might have called the police later (when confronted by the camera crew), but they clearly didn't seem to be concerned.

* Black Actor: Within seconds, people start to confront him. They talk about calling the police. They CALL the police, right then and there. Many are confrontational.

* White Female Actor: People walk by, mostly ignoring her; one guy offers to help her steal the bike.

That last one had me dying of laughter. If that video doesn't convey a direct, obvious example of white privilege, then I'm perfectly confident in saying you're the one who's got the closed mind -- or a political agenda to promote. That video is one indisputable example of white privilege.

Watch that video and tell me, with a straight face, that 90% of US prison populations are black men because they commit more crimes, and not because they simply are arrested more often. For drug crimes especially; I knew tons of kids who did drugs when I was in (my 99% white) high school, and none were harassed by cops, much less arrested. One guy's brother got arrested eventually for dealing [EDIT: Just remembered, he was or at least looked hispanic!]. Would that have been true if it were 99% black? I bet everyone I knew would have a story about being harassed.

> When challenged on this whole bizarre re-definition of equality, many will dismiss it as "reverse racism", meaning it's only racist against the dominant group, so who cares.

The dominant group doesn't need help. Some other groups do. Helping groups isn't the same as discrimination.

Girls do as well as boys in engineering and programming, and yet many cultural pressures push them away -- not least of which are the attitudes of boys (and other girls) toward girls who seem to "geeky." Is it bad to have programs that encourage girls to follow STEM career paths?

But if you fire a white person to maintain a quota of black employees, that is reverse racism, and it's illegal. I know because I'm friends with a (liberal) attorney who successfully won a multimillion dollar reverse-discrimination lawsuit against an employer who fired white employees to meet a minority quota. (IIRC--not sure if I have the details precisely correct.)

> At Missou, the activists demanded blacks-only housing so that they could explore their culture.

Were the activists black? Given the video above, and the way that blacks can be treated in the US, could you really blame them for wanting to live in a safe place, where someone isn't going to accuse them of ... whatever?

> So if you are a liberal Muslim woman seeking equal rights and treatment for Muslim women, the regressive left will actually fight against you, even trying to get you banned from speaking at a university.

This topic is far more complex than you're making it out to be -- and I can't claim to know all of the details. Among other things, there are people (and countries: France) that want to prevent Muslim women from wearing traditional Muslim garb in the name of "liberating" them. I would say that any government that is enforcing a particular behavior (that doesn't harm others!) has to provide the burden of proof that their actions are just. And forcing women to take off all head scarves or religious symbolism is no better than forcing them all to wear head scarves.

You're throwing up straw men by the ton; there are real people out there, suffering broad cultural prejudice, and people like you are trying to ridicule them by using terms like SJW. I'm a privileged, straight, white man, and I recognize that fact. Maybe it's easier to recognize because I also have a decent amount of wealth, but I'm not going to pretend that my success is entirely because I'm awesome. It was far easier for me to get where I am because I'm privileged, and I'm not going to poke fun at people who are trying to help those who aren't.

And I'm going to try to help disadvantaged people when I can, your ridicule or no.

[1] https://www.mtholyoke.edu/org/wsar/intro.htm

[2] https://www.youtube.com/watch?v=ge7i60GuNRg

comment 10y ago · link · parent

OK, I see your point -- in terms of language complexity. "Strict subset" wasn't precise. Sorry.

My impression comes from when I took a comparative programming languages class and we developed a Pascal interpreter.

I then took compiler design and over the course of two quarters implemented a compiler. Note I said "over TWO quarters." It took twice the time to create the compiler than the interpreter. A simple interpreter absolutely can be easier to write than a simple compiler.

That's what I'm talking about: The minimal requirements for writing an interpreter using a high level language (we used C++ -- this was 1988, so C++ before templates were a part of the language) are less complex than the minimal requirements for writing a compiler using a high level language (also C++, though with the addition of YACC and LEX).

The interpreter has to include a VM state, sure. But that state can be implemented in the state of the language you're using. I've written simple interpreters a half dozen times now -- very simple ones that I needed to run animations in games, or to script AI opponents, or to script UI layout and trigger UI interactions. The interpreted language was frequently barely Turing Complete, but I guarantee you that writing a compiler that spits out machine (or even assembly) code is much harder.

Among other things, you can rely on the host language itself to handle recursion. You can also create a "map" of global variables and, when the interpreter says to set a value, pull it out of the map.

I'm overgeneralizing for brevity, but I hope you see what I'm saying. Writing an interpreter for a simple language that maps well into the host language can actually be trivial -- the host language itself can provide much of the implementation.

Writing a compiler doesn't allow such shortcuts. You must code to the target machine architecture, not an arbitrarily complex (but well-mapped to the language) architecture stored in high level data structures. You must do all the hard work of reducing high level statements down to a sequence of low-level instructions.

If you're talking about writing an interpreter that spits out VM instructions (where it's basically performing a compile-to-vm), then sure, you're right: In that case you're writing a compiler and a VM and calling it an interpreter. Any real interpreter today would likely work this way, if only to be able to take advantage of LLVM -- and if you can use that, you can write your interpreter at exactly the same level of complexity as writing a compiler. The tasks would be equivalent.

If you're talking a transpiler that takes one high level language and spits out another high level language (thinking Babel, TypeScript, CoffeeScript, or even the early C++-to-C conversion tools), then sure, that would be even simpler than writing an interpreter.

If your task is just to write an interpreter, and the source and destinations languages are similar enough, then you can use shortcuts writing the interpreter (similar to writing the transpiler) that you just can't use writing a full compiler.

comment 10y ago · link · parent

Sorry, but no.

Writing an interpreter is strictly a subset of writing a compiler. Instead of spitting out machine instructions, you can use your source language to execute actions directly.

comment 10y ago · link · parent

Not the grandparent, but I don't run an ad blocker, which is how I "pay" for the sites. I do run NoScript, but I'll enable sites like the NYT.

It's sad how the entitlement mentality convinces people that they not only have the right to consume all media on the web for free, but they also have the absolute, inalienable right to view it without looking at ads. Because the

It seems very juvenile to me. "I want everything for free, even if it does cost money to create, and if I can't have it free, I'm going to post to complain about it!"

comment 10y ago · link · parent

OK, glad to hear that it does work for you. Sounds like you have a robust architecture.

I don't actually know what is supposed to "not scale" about Meteor. I've just read it multiple times. But because of the nature of Meteor (Really easy for anyone to set up! Anyone can create a real time app in ten minutes or less!), it probably attracts a lot of junior developers. It therefore should have occurred to me to translate "It doesn't scale!" to "I don't know how to scale it and my app is slow!!!". :)

comment 10y ago · link · parent

>A lot of missteps in the early days of web technologies have made stable URLs impractical, unfortunately.

Preserving URLs across technology migrations is always possible (assuming the old documents or at least a rough equivalent still exist in the new system), and usually not even hard, to achieve. Rewrites are not rocket science.

Assuming short-sighted developers put .php on the end of all the links, migrating to a better system can use rewrite rules that trivially remove any .php ending from a URL, or that remap old folder layouts to new folder layouts.

Even if you can't use mod-rewrite because of complexity that it can't handle, all you need is a server with a hash map (or equivalent) that responds with 301 redirects [1] from the old poorly designed link to the newer, cleaner link.

The other problem you mention (no deep linking at all) is its own form of stupidity in design, but since the deep links don't even exist, that's a separate issue.

[1] https://en.wikipedia.org/wiki/HTTP_301

comment 10y ago · link · parent

The FAQ repeats some things I've heard about Meteor -- specifically that its architecture doesn't scale.

But Meteor isn't completely prescriptive. There are several pieces that can be swapped out: You can use Angular, React, or Blaze on the client, for instance.

From what I've read, it doesn't look like Horizon is a complete framework, just a database client/server component that can be used with any framework.

comment 10y ago · link · parent

I held my nose when I was forced to write JavaScript until I learned about async/await.

I came from a language that can do this kind of thing implicitly using coroutines (i.e., I could write imperative code that would pause on a network request and resume afterwards). Have to wade through callback hell -- even with Promises -- was a serious step down.

With async/await being explicit, combined with functionality like Promise.all(), this is actually a better solution than I had before, because I can spawn a dozen queries at once and wait for them all to complete before I continue. I've used that to good advantage already once with an await Promise.all(...) call, and the patterns are so easy to follow that it brings tears to my eyes.

Or I can inject more traditional callbacks when the logic would be easier (or when it would allow several simultaneous calls to complete), which does happen from time to time.

As to whether I'd learn a new language because of it: I'm considering learning Elixir because of even stronger guarantees [1], actually, so yes, I would.

[1] Apparently in addition to being able to write code using light threads like this, you can also put a cap on how long the VM will run code, so if some idiot developer puts a loop in the code that doesn't return control enough, instead of destroying your UI experience it will just pause that loop and resume the main loop. Still have yet to try it though.

comment 10y ago · link · parent

I wrote some code that iteratively would have just taken a while to run, but because Haskell wasn't using true tail recursion, it ran out of stack space.

I also read a paper that talked about extensive research into optimizing a convolutional network algorithm in Haskell, if I remember correctly. The algorithm even used mutable data structures for speed (because of course you need data to be mutable for speed). Roughly speaking, if you ran it on 16 CPUs, it was only 4x slower than the C algorithm running on one CPU. And Amdahl's Law [1] (as well as the graph in the article) hints that it may never actually be faster than the single CPU C version, no matter how many CPUs you split it onto, because of the overhead of sending the data around.

When people claim "immutability makes it easier to run on more threads, which is the future of optimization!" I just want to cringe. Immutability kills most performance enhancements you can possibly make on nontrivial code, even considering a single thread, having all your data be immutable does nothing at all to improve threading, and forcing all data transferred to another thread to be immutable kills a whole category of optimization.

When dealing with large amounts of data, you save tons of time by not copying it around.

/rant

Sorry. I've been listening to too many people talk about Haskell like it's an amazing silver bullet that will solve all of our problems. But There Is No Silver Bullet. Really.

[1] https://en.wikipedia.org/wiki/Amdahl's_law

comment 10y ago · link · parent

I've been reading about Elixir recently, yes. Thanks for mentioning it, though. I'll have to look at it at some point, but since my code is primarily run-in-a-browser, I'm currently stuck with compile-to-JavaScript languages. I'm concerned that Elixir is too functional for my tastes (I find Haskell to be too pure (and slow) to be really usable for most tasks I work on, for instance), but I will give it a look at some point.

The entire point of writing in Go or Elixir would be to avoid needing to write an event based system in Rust (or C). Writing code as if it's imperative but getting the speed of an event-based system is what I'm looking for. Event-based systems are notoriously hard to reason about and debug.

comment 10y ago · link · parent

Funny. I managed to get Haskell to crash within about 20 minutes of first trying it out.

OCaml is supposed to be pretty fast, but so far Haskell hasn't impressed me with performance either.

comment 10y ago · link · parent

Rust does sound interesting, but it doesn't seem to be focused on the areas that I need right now.

Go has GoRoutines, which are light threads; they can be executed on multiple CPU threads, but by default Go only allocates one CPU thread per physical CPU, even if you allocate tens of thousands of GoRoutines.

For the kind of networking server code I'm writing, light threading is far more efficient than using an OS thread per connection. 25-50x faster at higher server loads.

That's why I've ignored Rust to date; if Rust has light threading built in, but no one is talking about it (haven't found anything but real threads in my quick Google searches), then I'll take a look. Otherwise it will need to wait for me to have a task that Rust would be good for, and I'll stick with Go and TypeScript for the problems I'm solving right now.

comment 10y ago · link · parent

Huh. I find that when my C++ compiles, it almost always works. Correctly.

But I used the language for nearly 20 years, so maybe it's experience and the patterns I've learned?

Not that Rust or Elm aren't better options; don't know, really. Despite feeling like I'm an expert in C++, I don't actually like the language much. I've used Go some, and I like it, but I haven't tried Rust or Elm yet.

comment 10y ago · link · parent

Most web sites are just grabbing data from databases. If you use an async front-end, it's the database servers that need to scale, because they're doing the heavy lifting. But scaling your database infrastructure can be orthogonal to scaling the application layer; in Node, except for under extreme load, you may never NEED to scale the application layer. And for really high load situations, you may need 25-50x fewer Node servers than PHP.

It's the poor design of most systems that cause them to not scale; there are certainly exceptions where the server needs to do a lot of complex calculations, but those calculations can most of the time be handled in microservices and, again, scaled orthogonally to the application layer.

comment 10y ago · link · parent

>benchmarks are sometimes bullshit, but the idea that node's approach is somehow light years ahead just doesn't pan out in the real world.

It's in the real world where you have database connections that can't always scale to 186k/second with low latency on all responses, which is what's required to get the performance out of HHVM in the linked benchmark. In a typical architecture you may not have the database local to the PHP server, meaning latency will be much higher. And it's upstream latency that kills a synchronous connection.

And it's in the real world where a number of third party queries may be involved with a request, and those queries may take 100ms to resolve, during which time your thread is blocked in PHP whereas Node can be busy handling other requests or even other aspects of the same request (a Promise.all of a half dozen simultaneous database queries, for instance).

Async approaches are light years ahead in the real world. I keep seeing references to HHVM when people try to defend PHP, so I did a Google search to find out if it supports async, and the answer is "a little bit." [1] Basically it looks like, within a single request, it can execute several queries in parallel, like my Promise.all example above. So it looks like Hack, at least, has that feature. But as far as I can tell it doesn't mix multiple connections in a single thread. And you have to be careful to use only async-aware operations or you lose the benefits; Node is designed around async behavior, so everything you're likely to use supports it by default.

Those benchmarks are in fact unrealistic. And the Node implementation in that benchmark uses a single connection to MySQL, so the 20 queries are actually executed in series instead of in parallel. [0] If they used a connection pool instead, they could all execute in parallel. Look at the numbers:

Queries 1 5 10 15 20 nodejs 85,490 22,917 12,083 8,250 6,254 hhvm 12,369 12,428 10,056 10,394 9,322

The NodeJS results shouldn't drop that fast off of the single query unless they're all using the same MySQL connection; even using just 4 connections from a pool should speed it up by a lot. Also, the HHVM source uses stored procedures while the Node version recompiles the query every time. Finally, Node can be faster when driven from Nginx, while it's using the internal Node server instead.

Here's an article I just stumbled across that talks about the limits of HHVM to accelerate PHP: [2] It touches on some of the same points. Async is the important way to speed up real world apps, and it's not the default "PHP Way."

Aside from that, probably 90% of the people using PHP are using it "normal" PHP on a hosted server in Apache and not HHVM at all. So you're basically arguing hypotheticals: "IF they use HHVM, and IF they write the code exactly right, and IF their upstream servers have really low latency all the time, then PHP isn't much slower than Node."

Node is usually faster in the real world given common coding patterns. And Node gives you Socket.IO, which pretty much kills the relevance of PHP no matter how you slice it. Even long polling would slaughter a PHP server; you'd be able to support at most one concurrent user per thread. Async servers are a good at supporting long running connections.

[0] https://github.com/TechEmpower/FrameworkBenchmarks/blob/mast...

[1] https://docs.hhvm.com/hack/async/introduction

[2] http://www.infoworld.com/article/2948132/app-servers/hhvm-38...

comment 10y ago · link · parent

To really scale a complex architecture, certainly there are other things you need to do, like setting up database replication and/or sharding, caching, and other scaling strategies.

That can typically be done from Node by simply adding the "use pooling" option in your database library (or sometimes by switching to the NPM for that database that enables pooling), and when you have additional slave databases, adding those to the database init call.

As far as Node is concerned, it really is that easy. Scaling PHP, though, pretty much requires that you add more threads, which means (after a point) you need a lot of RAM, or just adding more instances and load balancing between them.

Node won't prevent database scaling issues, but it will keep the part that it does handle a lot easier to maintain.

comment 10y ago · link · parent

>I assume you can imagine some cpu bound tasks that would have node.js at 12 connections/sec or less.

Certainly. That would fall under "newb/clueless" design, though. Anyone who would throw a CPU-bound task into a primary Node server shouldn't be allowed near architectural design decisions. Whereas code in PHP written using best practices can easily end up with a server that can barely hit 100 queries per second.

Imagine, for instance, a situation where the client needs to do 50 requests to the server to render a page [1][2], and each query ends up with 20ms of latency on the PHP side; assuming you're running 8 threads (and the client makes 8 concurrent requests), a single page query could block your server for 125ms. A slow client or network might even block your PHP threads for longer. Node could crunch through ten thousand requests like that per second when running on four CPUs, meaning 125 of these bloated pages rendered per second, compared to ... 8 or less.

Even with decent client pages that can render with ONE server query, a couple dozen database lookups are par for the course, sometimes including an authentication lookup on a third-party OAUTH server. That could be 125ms all by itself, and in PHP your thread is blocked while the lookup happens. With the async model, once the query is off, the server is doing work on other requests until the query has returned data.

Many CPU-bound tasks like "convert an image" are already coded in Node to happen in the background, triggering a callback when they're done so you can then send the result to the client. And in Node it's absolutely trivial to offload any likely CPU-bound task to a microservice, where the NodeJS server just queries the microservice and waits for the result. Which you'd want to do, of course, if a task is CPU-bound, because you would want a faster server than V8 running it anyway. Go would be a likely candidate, and Go handles threading either through light/async threads or via actual threading, as necessary. It's quite awesome.

And if you really can't trust your developer to write code without extensive time-consuming calculations, then make them use Elixir or Erlang. It will use preemptive multitasking at the VM level if a thread takes up too much time, and even if they foolishly write a task that takes hundreds of milliseconds to complete, it will still task swap and serve other clients.

But arguing that pathologically bad code in Node can make it perform as badly as PHP does all the time isn't exactly a ringing endorsement for the language.

[1] In 2014 the average number of objects a web page requested was 112, and seemed to continue to be going up, though I'm assuming a lot of those are static resources and third party requests, like for analytics and ads. http://www.websiteoptimization.com/speed/tweak/average-web-p... I've personally seen pages with 70-80 requests against a PHP backend to render one page.

[2] And I wouldn't call a client page needing 50 requests a best practice, but I'm assuming that we're talking about the server side here, and that we are being forced to deal with an existing client that behaves that way. So call it "best practices on the server."

comment 10y ago · link · parent

Strawman.

For tasks that are primarily IO bound, async architectures can scale more than synchronous languages. Period.

It would take intentionally (or newb/cluelessly) bad design to end up with a Node server that DOSed at 12 connections per second.

In PHP, if you run 4 threads, it just takes a backend with a 333ms latency (on all queries performed serially) to limit you to 12 connections per second. If you only run one thread, you just need a backend with a cumulative 83ms latency to get DOSed at 12 connections per second. In a more realistic scenario, a typical crappy framework will result in dozens of queries for a single page, but it comes down to the same thing.

In Node, you can run one thread with a cumulative 333ms backend latency and still handle thousands of connections per second. They'll each just end up waiting a bit more than 333ms for their results, assuming the database itself isn't DOSed (which takes a surprisingly high load -- way above the levels we're talking). Actually, depending on how interconnected the backend queries are, Node may actually result in less than a total 333ms latency, because many of those queries may also be parallelized by the browser, and will then be handled in parallel by the server (and much of the latency may actually be in http negotiations and/or establishing a database connection, honestly).

comment 10y ago · link · parent

Not talking NOOPs. I'm talking multiple full round trips to the database per query.

Node can render more NOOPs per second than that; I've heard of a well tuned Node server hitting 100k. But because of the async nature of the handling of responses, you don't need dozens or hundreds of threads to handle thousands of clients, and it's the threads that kill you.

Unless you've just got an awful architecture, in which case that will kill you first.

comment 10y ago · link · parent

That 2500 is after taking into account relevant database queries. With async servers (which, as far as I know, PHP can't be, at least with the way it typically integrates into Apache) you can accept all the requests, forward off the database requests each depends on, and still send back the pages to everyone who requested one.

Of course I've avoided WordPress and similar frameworks for years for a reason as well; I've seen front-end frameworks that require dozens if not hundreds of database queries to render a page, which is such bad design that it makes my brain hurt.

comment 10y ago · link · parent

I was shocked that 12 requests/second could take down any site.

I use async logic (previously OpenResty, more recently NodeJS and Go) and largely pregenerated sites, so 2500 requests/second is a minimum baseline -- on a much lower end instance than an m4.xlarge.

There's a reason I don't use PHP (or any primarily synchronous language like Ruby) any more.

comment 10y ago · link · parent

I test on iPad, iPod Touch, a half dozen Android devices, and on emulators. Works well everywhere, even with platform-specific differences in design to match different platform paradigms. And I have happy clients.

I've run into this attitude before, though. It seems to be the last bastion of denial of folks who have spent a lot of time learning one platform and who don't want to learn something new. Sorry, but there are better ways.

comment 10y ago · link · parent

    I don't subscribe to the school of thought that 
    values engineers lower on the stack more than 
    those higher up
Meaning developers who understand low-level details vs. developers who just wire up high level libraries?

I've done the full range, from entire games written in assembly language and embedded C code, through high level full stack development with NodeJS, Python, and other languages.

The low-level coding is far more skilled work than the high level coding. Instead of most of the work being "how do these plug in to each other?", it's how exactly does my code function with respect to all of the potential events additional threads, and how all of the edge cases interact, and what is causing this obscure bug?

While that may not seem intrinsically harder, none of these are typically something you can Google or search StackOverflow for the answers on. So you're really just on your own. And developers who have grown up on "Google all the answers!" often hit a wall when they need to apply real problem solving skills.

Luckily I can find enjoyment in many levels, since a lot of the jobs I've found recently have been more of the "full stack" or "mobile development' category. It's easy and fun work.

I also have little problem piercing the magic and understanding how things fit together, but that means that I end up with opinions on many topics divergent with the crowd. For instance, I avoid writing Android/Java or iOS/Swift, and instead use cross-platform development stacks exclusively. Yes it means an entire extra layer of complexity, but it also means I write the app once for all target platforms. Far too big of a win to ignore.

1
171819
50