iTranslated by AI

The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
🏆

ISUCON13 Experience Report

に公開

Introduction

I participated in ISUCON13 as part of a team named "FormerColleague_Latest_FinalVersionCopy(2)_oldDefinitive.xlsx" (元同僚_最新_最終版コピー(2)_old決定版.xlsx) along with junki555 and vtryo. This was my second time participating, following last year.

Last Year's Results (and Atmosphere)

Since I didn't write a blog post for last year, please refer to my teammates' blogs.

The languages used were Ruby/Go (We started with Ruby, but since we couldn't raise the score much until the end, we switched to Go, which seemed slightly faster in execution speed, for the finish).

The final score was 3160.

This Year's Results

This year, we participated with the goal of "anyway, let's break 10,000 points."

The language was Go. We started with a score around 3500 and finished at about 10500.

Role Division

  • JUNKI555, Myself
    • Application code
    • DB Schema (mainly adding indexes)
  • VTRyo
    • Infrastructure-related
    • Aggregation of web server logs and slow queries and Slack notification

We shared the work like this.

My Results

While looking at the alp output, we realized that GET /api/user/:username/statistics was slow, so I fixed the N+1 issue in getUserStatisticsHandler.

It took about half of the competition time to pass the consistency check. I think the score went up by about 2000 (I believe).

In reality, that was the only thing I was able to accomplish. Next, I tried to create a caching mechanism for icon image hashes, but when I added a column, it affected many other parts of the code, so I gave up (actually, it seemed better to use something like Redis, but since I hadn't practiced such an introduction, I didn't touch it).

Then, I tried to fix another N+1 issue elsewhere, but as time was running out, I gave up on that as well.

Challenges Felt

This is a challenge focused solely on myself, but the main point of reflection is that my implementation was simply slow. Since I don't usually write Go, I got stuck on things even before the ISUCON-specific parts. For example, regarding the usage of sqlx, I lost time because I had to catch up by looking up errors for things like: getContext can be used for mapping a single record while selectContext is for multiple records, or that struct tags like db:"column_name" are necessary for mapping.

It was completely foreseeable, but I felt that a certain amount of practice with the language being used is essential. Also, because I've been involved in DynamoDB projects for the past few years, my SQL muscles for things like JOINs and subqueries have become considerably weak, which also hindered my implementation.

Additionally, there was an issue where the cycle of code change → consistency check was taking too much time each time. This time, we made the decision not to build a local development environment and ran the Bench every time we changed the code. In addition to the execution time and waiting time of the Bench itself, we ended up competing for the Bench among the three of us, which prevented us from developing efficiently.

Looking Towards Next Time

In addition to practicing the Go language, of course, I want to be able to run the cycle of code change → consistency check rapidly. I'm wondering if I should try building a local development environment... but I'm hesitant because of the risk of getting stuck and wasting time.

I saw somewhere that you can perform only consistency checks using bench --pretest-only, so I'm planning to check that out as well.

Conclusion

It was simply fun. I was able to exceed our goal of 10,000 points, so I'm satisfied for now. I want to participate again next year.

Discussion