Okay, so today I messed around with Puma. I’d heard of it before, you know, as a Ruby web server, but I’d never actually used it. Thought I’d give it a shot and see what all the fuss was about.

Puma Jones: Discography and Biography (All the music details you want)

First things first, I needed to get it installed. I already had Ruby set up, so it was pretty simple. Just popped open my terminal and typed in:

gem install puma

Boom! Done. That was easy. Now, I needed something to actually run with Puma. I didn’t feel like building a whole Rails app, so I grabbed a super simple Sinatra app I had lying around from another project. It basically just says “Hello, world!” Nothing fancy.

Getting it Running

Next, I needed to figure out how to actually start the server. I looked at the Puma documentation real quick, and, no big surprise, it’s also pretty straightforward. I navigated to my Sinatra app’s directory in the terminal and typed:

puma

Puma Jones: Discography and Biography (All the music details you want)

And…it started! I saw some output in the terminal, telling me it was listening on a certain port (I think it was 9292 by default?). So, I opened my browser, typed in localhost:9292, and there it was! My “Hello, world!” message. Okay, cool, it works.

Playing Around

Now I wanted to see what else I could do. I remembered something about a configuration file. So, I created a new file called config/*. Inside, I played with a few options, like changing the port and the number of threads:

  • Threads: I messed around with the threads setting. From what I understand, this controls how many requests Puma can handle at the same time. I set it to something like min 1, max 4, just to see if it would break. It didn’t.
  • Port: I changed the port to 3000, because, why not? Just had to add a line like port 3000 to the config file.

After making those changes, I stopped the server (Ctrl+C in the terminal) and restarted it using the config file:

puma -C config/*

Checked the browser again (now at localhost:3000), and it still worked! So the config file was definitely doing something.

Puma Jones: Discography and Biography (All the music details you want)

Wrapping Up

So, that was my quick and dirty experience with Puma. Seemed pretty easy to use and set up. I didn’t dive into anything super complex, like deploying it or setting up workers (which I know it can do), but for a simple local development setup, it seems great. I’ll probably use it again for my next small Ruby project. It’s nice to have options, you know?

LEAVE A REPLY

Please enter your comment!
Please enter your name here