Ahrefs12 open jobs

OCaml Developer

Software engineeringPosted over 2 months agofrom Ahrefs's own hiring page

Work type
On-siteSan Francisco Bay Area, Boston, Cambridge
Experience
Not stated
Pay
Not listedUsually $99k a yearSoftware engineering, median, all levels, in the US (Payscale)
Posted
Over 2 months agoOpen over 2 years
Before you apply: make your resume fit this job

Skills it mentions

Add your skills to see which ones you have.

Interview questions for this job6 with answers below, on C++ and Linux

About the job

Ahrefs is looking for a backend developer with deep understanding of networks, distributed systems, OS fundamentals and taste for simple and efficient architectural designs. Our backend is mostly implemented in OCaml with some C++.

This role is based out of one of our offices — Palo Alto, Cambridge (MA), You can be based in whichever of these you have the legal right to work in, but this is an on-site role: we're looking for someone who'll be in the office with the team.

In this role, be prepared to deal with 25 petabytes of live data, OCaml and Linux on a daily basis.

Ahrefs OCaml

Basic Requirements:

  • Proficiency in OCaml
  • Knowledge of C++ is a plus but not essential

The ideal candidate is expected to:

  • Independently deal with bugs, schedule tasks and investigate code
  • Make well-reasoned technical choices and take responsibility for them
  • Understand the whole technology stack at all levels: from network and user-space code to OS internals and hardware
  • Handle full development cycle of a single component i.e. formalize task, write code and tests, setup and support production, resolve user requests
  • Approach problems with a practical mindset and suppress perfectionism when time is a priority
  • Write flexible, maintainable code and adapt to post-launch requirements/tweaks

These requirements stem naturally from our approach to development with fast feedback cycle, highly-focused personal areas of responsibility and strong tendency to vertical component splitting.

If your preference is leaning towards making the web functional and working on user-facing stuff, you may want to consider our ReasonML position instead.

What You Get

We offer:

  • Competitive compensation package
  • Informal and thriving work atmosphere
  • Above-average perks and fringe benefits
  • First-class workplace (hardware, software, etc) in the modern office

Location: Palo Alto, Cambridge (MA), — on-site

Ahrefs does not engage with agencies or third party recruitment solutions for the roles we hire for. If at any point we need help, we'll let you know! 

Interested?OCaml Developer at Ahrefs

Apply on company site (opens in a new tab)

The job ad ends here

Interview questions for this job6 with answers, on C++ and Linux

Interview questions for this job

For the skills the ad mentions: C++ and Linux.

370 questions
  • Why is reading lines from stdin much slower in C++ than Python?C++

    tl;dr: Because of different default settings in C++ requiring more system calls.

    By default, cin is synchronized with stdio, which causes it to avoid any input buffering. If you add this to the top of your main, you should see much better performance:

    std::ios_base::sync_with_stdio(false);
    

    Normally, when an input stream is buffered, instead of reading one character at a time, the stream will be read in larger chunks. This reduces the number of system calls, which are typically relatively expensive. However, since the FILE* based stdio and iostreams often have separate implementations and therefore separate buffers, this could lead to a problem if both were used together. For example:

    int myvalue1;
    cin >> myvalue1;
    int myvalue2;
    scanf("%d",&myvalue2);
    

    If more input was read by cin than it actually needed, then the second integer value wouldn't be available for the scanf function, which has its own independent buffer. This would lead to unexpected results.

    To avoid this, by default, streams are synchronized with stdio. One common way to achieve this is to have cin read each character one at a time as needed using stdio functions. Unfortunately, this introduces a lot of overhead. For small amounts of input, this isn't a big problem, but when you are reading millions of lines, the performance penalty is significant.

    Fortunately, the library designers decided that you should also be able to disable this feature to get improved performance if you knew what you were doing, so they provided the sync_with_stdio method. From this link (emphasis added):

    If the synchronization is turned off, the C++ standard streams are allowed to buffer their I/O independently, which may be considerably faster in some cases.

    From Stack Overflow: asked by JJC, answered by Vaughn Cato (CC BY-SA 4.0)

  • How do I get the size of a directory on the command line?Linux

    du -sh file_path

    Explanation

    • du (disc usage) command estimates file_path space usage
    • The options -sh are (from man du):

        -s, --summarize
               display only a total for each argument
        -h, --human-readable
               print sizes in human readable format (e.g., 1K 234M 2G)
      

      To check more than one directory and see the total, use du -sch:

        -c, --total
               produce a grand total
      

    From Unix & Linux Stack Exchange: asked by Abdul Al Hazred, answered by sam (CC BY-SA 4.0)

  • What is the '-->' operator in C/C++?C++

    --> is not an operator. It is in fact two separate operators, -- and >.

    The code in the condition decrements x, while returning x's original (not decremented) value, and then compares the original value with 0 using the > operator.

    To better understand, the statement could be written as follows:

    while( (x--) > 0 )
    

    From Stack Overflow: asked by GManNickG, answered by Charles Salvia (CC BY-SA 4.0)

  • What is a CLI? Tell me about your favorite CLI tools, tips, and hacks.LinuxBasic

    CLI is an acronym for Command Line Interface or Command Language Interpreter. The command line is one of the most powerful ways to control your system/computer.

    In Unix like systems, CLI is the interface by which a user can type commands for the system to execute. The CLI is very powerful, but is not very error-tolerant.

    The CLI allows you to do manipulations with your system’s internals and with code in a much more fine-tuned way. It offers greater flexibility and control than a GUI regardless of what OS is used. Many programs that you might want to use in your software that are hosted on say Github also require running some commands on the CLI in order to get them running.

    My favorite tools

    • screen - free terminal multiplexer, I can start a session and My terminals will be saved even when you connection is lost, so you can resume later or from home
    • ssh - the most valuable over-all command to learn, I can use it to do some amazing things:
      • mount a file system over the internet with sshfs
      • forward commands: runs against a rsync server with no rsync deamon by starting one itself via ssh
      • run in batch files: I can redirect the output from the remote command and use it within local batch file
    • vi/vim - is the most popular and powerful text editor, it's universal, it's work very fast, even on large files
    • bash-completion - contains a number of predefined completion rules for shell

    Tips & Hacks

    • searches the command history with CTRL + R
    • popd/pushd and other shell builtins which allow you manipulate the directory stack
    • editing keyboard shortcuts like a CTRL + U, CTRL + E
    • combinations will be auto-expanded:
      • !* - all arguments of last command
      • !! - the whole of last command
      • !ssh - last command starting with ssh

    Useful resources:

    From Test your Sysadmin Skills (MIT)

  • What is the copy-and-swap idiom?C++

    Overview

    Why do we need the copy-and-swap idiom?

    Any class that manages a resource (a wrapper, like a smart pointer) needs to implement The Big Three. While the goals and implementation of the copy-constructor and destructor are straightforward, the copy-assignment operator is arguably the most nuanced and difficult. How should it be done? What pitfalls need to be avoided?

    The copy-and-swap idiom is the solution, and elegantly assists the assignment operator in achieving two things: avoiding code duplication, and providing a strong exception guarantee.

    How does it work?

    Conceptually, it works by using the copy-constructor's functionality to create a local copy of the data, then takes the copied data with a swap function, swapping the old data with the new data. The temporary copy then destructs, taking the old data with it. We are left with a copy of the new data.

    In order to use the copy-and-swap idiom, we need three things: a working copy-constructor, a working destructor (both are the basis of any wrapper, so should be complete anyway), and a swap function.

    A swap function is a non-throwing function that swaps two objects of a class, member for member. We might be tempted to use std::swap instead of providing our own, but this would be impossible; std::swap uses the copy-constructor and copy-assignment operator within its implementation, and we'd ultimately be trying to define the assignment operator in terms of itself!

    (Not only that, but unqualified calls to swap will use our custom swap operator, skipping over the unnecessary construction and destruction of our class that std::swap would entail.)

    An in-depth explanation

    The goal

    Let's consider a concrete case. We want to manage, in an otherwise useless class, a dynamic array. We start with a working constructor, copy-constructor, and destructor:

    #include <algorithm> // std::copy
    #include <cstddef> // std::size_t
    class dumb_array
    {
    public:
        // (default) constructor
        dumb_array(std::size_t size = 0)
            : mSize(size),
              mArray(mSize ? new int[mSize]() : nullptr)
        {
        }
        // copy-constructor
        dumb_array(const dumb_array& other)
            : mSize(other.mSize),
              mArray(mSize ? new int[mSize] : nullptr)
        {
            // note that this is non-throwing, because of the data
            // types being used; more attention to detail with regards
            // to exceptions must be given in a more general case, however
            std::copy(other.mArray, other.mArray + mSize, mArray);
        }
        // destructor
        ~dumb_array()
        {
            delete [] mArray;
        }
    private:
        std::size_t mSize;
        int* mArray;
    };
    

    This class almost manages the array successfully, but it needs operator= to work correctly.

    A failed solution

    Here's how a naive implementation might look:

    // the hard part
    dumb_array& operator=(const dumb_array& other)
    {
        if (this != &other) // (1)
        {
            // get rid of the old data...
            delete [] mArray; // (2)
            mArray = nullptr; // (2) *(see footnote for rationale)
            // ...and put in the new
            mSize = other.mSize; // (3)
            mArray = mSize ? new int[mSize] : nullptr; // (3)
            std::copy(other.mArray, other.mArray + mSize, mArray); // (3)
        }
        return *this;
    }
    

    And we say we're finished; this now manages an array, without leaks. However, it suffers from three problems, marked sequentially in the code as (n).

    Read the rest at the sourceFrom Stack Overflow: asked by GManNickG, answered by GManNickG (CC BY-SA 4.0)

  • Why did you leave your last job?Behavioural

    The employer may ask you questions about leaving your last job.

    If you've been out of work for a long time, explain why. Talk about the positive things you've done while away from work. For example, networking, retraining, volunteering or keeping fit.

    If you:

    • left by choice: be positive about why you want a new job and describe why their company suits you better
    • got made redundant: explain the situation, be positive and describe how you've responded since
    • were fired for misconduct or poor performance: explain why your standards dropped, what you've learned and how you've improved since the experience

    From National Careers Service: interview advice (Open Government Licence v3.0)

Similar jobs

More like this: Software engineer jobs in San Francisco Bay Area (707), Jobs in San Francisco Bay Area (9,193) and Software engineer jobs in the USA (1,765)