792 karma · joined Jan 16, 2014 (12y ago) · 369 submissions
comment 7y ago · link · parent
* Progressively introduce Rust instead of replacing entire applications (Rust really shines in this area)
* Leverage node's strong HTTP and routing story while waiting for this to stabilize in Rust
* Leverage existing tooling for APM, config management, etc.
For example, one middleware verifies the request body with a signature from a header. Another one parses the body from a `Buffer` to JSON, transforms, and serializes as protobuf.
comment 8y ago · link · parent
comment 8y ago · link · parent
I didn't want to port APM code as well, so I kept node.js/express for routing. Very simple middleware that immediately passed the request and body buffer to Rust for handling. Rust returned a buffer back to express for sending the response.
It's easily able to hit 100k RPM on a single instance before hitting a CPU bottleneck in the Rust code (validating an RSA signature). It only needs to handle 90k RPM total.
comment 8y ago · link · parent
comment 8y ago · link · parent
In my opinion, one of the most important and most difficult parts of the job. Architecture and design shouldn't be limited to senior engineers--it won't be in practice, anyway. Doing so is a sure fire way to stilt the growth of your team.
But, reviewing designs is hard. It requires recapturing much of the context that the engineer gathered in a very short period of time. I also find it sometimes difficult to separate, "this is a fatal design flaw" from "this isn't how I would do it." I really like the suggestion of providing feedback via additional information.
Mistakes are a very important part of learning. I try to make sure everyone has the opportunity to make their own instead of making mine.
comment 8y ago · link · parent
React uses the term "danger" to express a similar concept. You are trusting this value to already have been sanitized / escaped.
https://reactjs.org/docs/dom-elements.html#dangerouslysetinn...
¯\_(ツ)_/¯ I don't actually feel that strongly about a keyword that is used sparingly.
Aside: Thanks for everything you do for Rust and the community!
comment 8y ago · link · parent
Of course, if you own the parent site you can replace the iFrame with anything you want.
comment 8y ago · link · parent
comment 8y ago · link · parent
18.
Neon 0.2 Released (Node.js FFI for Rust)(twitter.com ↗)
5 points · by vkjv · 8y ago · discuss
comment 8y ago · link · parent
-Robert A. Heinlein
comment 8y ago · link · parent
FROM rust:latest
RUN rustup target install x86_64-unknown-linux-musl
COPY . /src
WORKDIR /src
RUN cargo build --release --target=x86_64-unknown-linux-musl
FROM scratch
COPY --from=0 /src/target/x86_64-unknown-linux-musl/release/rust_docker_barebones /rust_docker_barebones
ENTRYPOINT ["/rust_docker_barebones"]
Although, I typically recommend _not_ using the scratch container unless you really need something that tiny. It makes debugging very difficult if you don't at a minimum have a shell and a package manager.Also, packaging up rust to be static like this can take some extra steps. For example, loading in root certificates.
comment 8y ago · link · parent
It can be as simple as adding something like this at the end of your Dockerfile.
FROM debian:jessie-slim
COPY --from=0 /src/target/release/my-bin /usr/bin/my-bin
ENTRYPOINT ["my-bin"]comment 8y ago · link · parent
As a parent, this is something that I care deeply about. If this is a consistent issue in your neighborhood, I strongly encourage you to contact your local police department. This type of driving in a residential area is significantly more dangerous to the community than a lemonade stand could ever possibly be.
comment 8y ago · link · parent
I think correctness is the most important one. Even if a manual task is quick, ensuring that you do it correctly and exactly the same way for all 30-50 things is extremely tedious. If one out of those 50 subdomains was behaving differently and you needed to investigate exactly why, that could quickly erode any time savings.