HNHacker News
TopNewBestAskShowJobs

reza_n

310 karma · joined March 24, 2015

Reza Naghibi https://reza.naghibi.com

I write fast code, fast.

submissionscomments
reza_n··on Ask HN: Are there any reasonable alternatives to MacBook Pro for developer?
Lenovo Thinkpad X1 carbon. I have a 2nd gen I bought in 2014 and its been rock solid for the last 4 years. I have been running Ubuntu since day 1 and have had 0 issues. I travel with this laptop daily, so its very mobile. Lightweight, quiet, and performance has never been an issue.
reza_n··on C for All
Constructs like closures come at a cost. Function call abstraction and locality means hardware cannot easily prefetch, instruction cache misses, data cache misses, memory copying, basically, a lot of the slowness you see in dynamic languages. The point of C is to map as close to hardware as possible, so unless these constructs are free, better off without them and sticking to what CPUs can actually run at full speed.
reza_n··on Varnish Cache 6.0.0
I would prefer to keep this public just because its sometimes a good idea to have a record of things like this. I feel this wont be the last time this rears its ugly head.

> you've demonstrated to the world in this thread you have no idea how virtual memory works

Funny, I kind of consider myself an expert in virtual memory and I previously made no mention of virtual memory in any of my comments. I do consider virtual memory an extremely important part in getting high levels of performance from a cache. Did you confuse sendfile() and copying data from block devices into userspace with virtual memory?

Why am I not surprised at this reply.

reza_n··on Varnish Cache 6.0.0
> Someone in the varnish org should be able to do a competitive analysis of Varnish, ATS, and Nginx in a couple days that would be enlightening and prudent use of time to guide your product development.

Really? I would say most of us are comfortable with how Nginx and ATS are engineered and how the kernel works.

If anything, I think the concern is the fact that you are working for a publicly traded CDN yet you came to this thread armed with nothing more than a load of BS and FUD. I will say this connected a few dots in my mind and possibly added some color to what others think.

reza_n··on Varnish Cache 6.0.0
Another huge load of BS. What is your goal here?

> epoll/kqueue

Here is the implementation from 2.1, back maybe around 10 years ago:

https://github.com/varnishcache/varnish-cache/blob/2.1/bin/v...

https://github.com/varnishcache/varnish-cache/blob/2.1/bin/v...

> nginx thread model

https://www.nginx.com/blog/thread-pools-boost-performance-9x...

> With sendfile(2) and splice(2) you are only wiring up the activity to be done in your event loop

Why you are storing your cache on disk into individual files when its "2018 and RAM is commonly measured in many hundred GB" is beyond me. But its not even worth discussing because you will just introduce more BS, FUD, and techno babble.

reza_n··on Varnish Cache 6.0.0
This is another misinformed rant.

> Varnish I/O model is ignorant of TLB flushing, instruction cache, VM hints like madvise(2), and the overhead (and downright difficult job) of an OS scheduler.

TLB flushing is a hardware problem, not a software problem. Instruction cache? Last I checked, the varnishd binary is about 2MB and uses very predictable jumping and straight function calling. Im pretty sure your going to be getting a 99% instruction cache hit rate. Madvise is used in Varnish's storage engine's, and there seems to be little interest or knowledge about how Varnish uses storage here.

> If my points didn't have some validity, Fastly would not have done what they did.

Can you expand on what Fastly did? They published a non locking memory allocator? So the claim is that memory allocation is the bottleneck and jemalloc is not suitable?

Sounds like someone might be stuck in performance hell and you are trying to draw parallels to Varnish which simply don't exist!

reza_n··on Varnish Cache 6.0.0
> Doing a thread per connection is about the worst conceivable design for web acceleration.

A better statement here would be connections are serviced by a pool of workers. Event polling is used. A single worker can and does process tens of thousands of requests a second. Workers are used to get request parallelism across multiple cores. When a request blocks, that worker will work on another request. Varnish easily beats out pure event driven software in 99perc response times because of its worker pool designed. Very puzzling that you are claiming otherwise.

> going to be dropping performance on the floor vs other I/O models as you get into the 1000s of connections

I have done benchmarks with over 100,000 active connections a second, with a mix of blocked, slow, fast connections, cache hits, misses, and passes. Performance is great, ~100us response times, very low CPU utilization.

> So be prepared to do some deep systems work if you need high scalability out of Varnish.

Not at all. Once again, I did some benchmarks not too long ago and was able to get 100Gbit/sec using a stock Varnish + stock Linux. Response time was well under 1ms per request.

Hitting high levels of scale and performance is an IO problem, not really a CPU problem. A lot of the criticism here is misinformed and focused on CPU scheduling. Not a single mention about any of the IO optimizations used in Varnish and other competing products.

reza_n··on Startup Ideas We'd Like to Fund (2008)
> 3. New news.

NY Times topped $1 billion in subscription revenue last year. Quite a feat and definitely an indication that money is to be made in digital news.

https://www.nytimes.com/2018/02/08/business/new-york-times-c...

reza_n··on Memory Safety in Rust: A Case Study with C
> But it certainly can change the condition in the assertion so that it won't fire on overflow.

Once again, why would a compiler do that? To satisfy the Rust community's desire to spread FUD throughout the C community? (sorry to be so blunt, but im really scratching my head here)

A more logical thought process here is that signed operations aren't uniform across architectures and are sometimes emulated, leading to UB for certain edge cases, like overflow. Its more practical to believe that a future C standard will fix this loophole rather than think compilers will exploit this and punish their own community.

Very not impressed with this thread.

reza_n··on Memory Safety in Rust: A Case Study with C
I can see the point you are trying to make, but in this context, it doesn't work. Lets start at line 20:

  vec.capacity = 0;
Next, line 26:

  int new_capacity = vec->capacity * 2;
So we get new_capacity = 0 * 2, so new_capacity is 0. The assert:

  assert(new_capacity > vec->capacity);
Which translates to 0 > 0, it triggers a fail and we are done. If the compiler were to 'optimize' that out, then the compiler just introduced a very serious and fatal bug in our program, and we didn't even overflow or UB.

So that assert works as intended, it forces new_capacity to grow until it hits INT_MAX or UB, at which point it will assert.

reza_n··on Memory Safety in Rust: A Case Study with C
How does a compiler know that signed overflow will happen in the above snippet? Couldn't all integer math result in overflow? If so, how does the compiler ever know what to do?

I do not think its plausible that the compiler is emitting code which checks for an overflow and then in a deterministic fashion skips all dependent logic there after. Im sorry, but I think this line of argument has been taken to such an extreme it has detached from reality.

reza_n··on Memory Safety in Rust: A Case Study with C
Nothing in the snippet is undefined. The assert simply enforces the size always increases.

Not sure I understand why you think the assert() gets removed. Is this documented somewhere?

Hint: vec->capacity could be 0

reza_n··on Memory Safety in Rust: A Case Study with C
Overflow is a runtime behavior, not a compile time behavior. How a type overflows is dependent on the CPU, not software.
reza_n··on Memory Safety in Rust: A Case Study with C
I would argue the opposite, assert() statements are the best way to write defensive and secure C. There might have been a time when people commonly compiled out assert() statements from binaries, but that is only OK if the software was designed for that. Otherwise, that would be like me saying I am going to compile out all strlen() statements from a given binary and then expect it to behave the same.
reza_n··on Memory Safety in Rust: A Case Study with C
Very valid point. The code for that:

  int new_capacity = vec->capacity * 2;
  assert(new_capacity > vec->capacity);
reza_n··on Memory Safety in Rust: A Case Study with C
As another poster pointed out, if I run this via valgrind (after fixing the first error):

  > valgrind ./a.out

  ==4871== Invalid write of size 4
  ==4871==    at 0x40073A: vec_push (test.c:40)

  ==4871== Invalid write of size 4
  ==4871==    at 0x40073A: vec_push (test.c:40)

  ==4871== Invalid read of size 4
  ==4871==    at 0x4007CD: main (test.c:55)

  ==4871== Invalid read of size 8
  ==4871==    at 0x400769: vec_free (test.c:46)

  ==4871== Invalid free() / delete / delete[] / realloc()
  ==4871==    at 0x4C2BDEC: free (...)
  ==4871==    by 0x400770: vec_free (test.c:46)
reza_n··on Memory Safety in Rust: A Case Study with C
Not exactly the best example. If I take this code (test.c) and try to compile it:

  > gcc test.c
I get an error:

  test.c:21:3: warning: function returns address of local 
  variable [-Wreturn-local-addr]
     return &vec;
After I fix that error, the program segfaults when running. Compile with asan:

  > gcc test.c -Fsanitize=address -lasan -g
Then we can start debugging these problems:

  ==3261== ERROR: AddressSanitizer: attempting double-free on 0x60040000dfd0:
      ...
      #2 0x4008b5 in vec_free ./test.c:46
Not trying to say that this is the best workflow for debugging C, but the tooling does exist for these kinds of programming errors.
reza_n··on Ask HN: Who is hiring? (February 2018)
Varnish Software | Software Engineer | London, UK

Varnish Software is the company behind Varnish Cache. Varnish Software works with top global enterprises helping them use Varnish Cache to increase web performance and to build private CDNs, consumer CDNs, and advanced edge platforms.

At Varnish Software, we take pride in our software and products and we value innovation. We strive to hire team members who share these values. We offer an open, honest, and international culture in a laid back and stimulating work environment. You will be working with some of the most brightest and talented people in the industry. We offer competitive salaries, full benefits, generous vacation time, and much more.

Job description:

* Create, develop and maintain Varnish products and solutions

* Provide technical guidance and industry best practices to customers

* Interact with prospects during the sales process

* Hacking on various projects (side projects encouraged)

* International travel for customer meetings, conferences, and office workshops

Desired skills and experience:

* Experience with Varnish Cache and VCL

* Experience with C, scripting languages, Linux programming

* Good understanding of TCP and HTTP protocols and troubleshooting tools

* Comfortable explaining technical solutions and details to a non-technical audience

* Public speaking or writing experience is a plus

To apply, please send your resume or questions to jobs@varnish-software.com

reza_n··on Micromouse
See if you can spot the sub 4s route: https://youtu.be/IngelKjmecg
reza_n··on The Merge
A lot of the examples brought up are innovations in communication, not AI. Phones, social media, and search are communication platforms. Just like books, newspapers, telegraph, telephones, internet, they enable communication, interaction, ideas, innovation, etc. Even what we consider AI today is just a complicated birds nest of human driven math. Sure, we can go ahead and classify phones as co evolving AI, but the same can be said of plants, trees, and animals that have co evolved with us as well.
reza_n··on Ask HN: Who is hiring? (December 2017)
Varnish Software | Software Engineer | NYC, London

Varnish Software is the company behind Varnish Cache, a widely recognized open source HTTP proxy that significantly enhances web performance and enables digital content delivery. Varnish Cache has experienced tremendous growth since its inception and currently powers more than 2.8 million websites globally.

Varnish Software works with top global enterprises helping them use Varnish Cache to increase web performance and to build private CDNs, consumer CDNs, and advanced edge platforms. Over 100 top global brands and enterprises trust Varnish Software in helping them meet their application performance and content delivery needs. Varnish Software maintains its own proprietary branch of Varnish Cache and a line of Varnish based products and solutions.

At Varnish Software, we take pride in our software and products and we value innovation. We strive to hire team members who share these values. We offer an open, honest, and international culture in a laid back and stimulating work environment. You will be working with some of the most brightest and talented people in the industry. We offer competitive salaries, full benefits, generous vacation time, and much more.

We are currently looking for a Software Engineer to join our teams in New York City and London.

Job description:

* Create, develop and maintain Varnish products and solutions

* Provide technical guidance and industry best practices to customers

* Interact with prospects during the sales process

* Hacking on various projects (side projects encouraged)

* International travel for customer meetings, conferences, and office workshops

Desired skills and experience:

* Experience with Varnish Cache and VCL

* Experience with C, scripting languages, Linux programming

* Good understanding of TCP and HTTP protocols and troubleshooting tools

* Comfortable explaining technical solutions and details to a non-technical audience

* Public speaking or writing experience is a plus

To apply, please send your resume or questions to jobs@varnish-software.com

reza_n··on Disable transparent hugepages
Not to mention that there was a race condition in the implementation which would cause random memory corruption under high memory load. Varnish Cache would consistently hit this. Recently fixed:

https://access.redhat.com/documentation/en-us/red_hat_enterp...

reza_n··on Equifax CEO to Congress: Not Sure We Are Encrypting Data
The get operation provides parts of the key used to decrypt the data you are after. No key, no data.

Edit: the key comes from the user, its not stored anywhere on a server. The key can optionally never leave the user's device.

reza_n··on Equifax CEO to Congress: Not Sure We Are Encrypting Data
We have an encryption scheme where all user data has its own unique user based key. So compromising 1 user key only lets you have access to that user data and that key has access to nothing else. Your statement is correct when you said that automated systems which need access to all data will inevitably lead to mass decryption and compromise. In the system described above, there is no way for an automated system (or anything) to have access to all keys and therefor no system or person can access all data.
reza_n··on The Curious Case of the Longevity of C
It is well understood that all variables need to be initialized. Most compilers consider uninitialized variables an error. So I would say someone running into this and possibly other UB scenarios is just a case of writing bad code.
reza_n··on The Curious Case of the Longevity of C
Please explain how that is UB?
reza_n··on The Curious Case of the Longevity of C
Do you have any examples of this uncertainty? I hear this argument a lot, but have a hard time understanding why this seems to be a common grievance. I've been writing C for years and never once did I hit a scenario of dealing with undefined or uncertain behavior. Writing normal C is very well defined. No?
reza_n··on So much for that Voynich manuscript “solution”
Given some of the progress here [1], there is a chance it can be translated in the near future if given the proper resources.

[1] https://youtu.be/lhtZc-nFNt0

reza_n··on Is there a winning strategy in Tetris?
Search for "tetris championship" on YouTube. Some great tetris gameplay and you can pick up on a lot of the strategy pros use.

Ex: https://youtu.be/DdfRQjb5o9k

reza_n··on Ask HN: Who is hiring? (September 2017)
Varnish Software | Software Engineer | New York City (NYC), NY

Varnish Software is the company behind Varnish Cache, the popular open source caching proxy. Looking for a full time onsite engineer who is comfortable working with Varnish Cache and VCL, C, Linux, HTTP and with client facing interactions. Full benefits offered.

If you are interested, please email: reza AT varnish-software DOT com

← PreviousPage 2 of 4Next →