Performance Requirements

We have a performance challenge. Our product owner indicates that we expect a large volume of users. The initial release should support tracking 50,000 users simultaneously.

We write a test that emulates scaling up to large numbers of users.

c9/3/GeoServerTest.cpp
 
TEST(AGeoServer_UsersInBox, HandlesLargeNumbersOfUsers) {
 
Location anotherLocation{aUserLocation.go(10, West)};
 
const​ ​unsigned​ ​int​ lots {500000};
 
for​ (​unsigned​ ​int​ i{0}; i < lots; i++) {
 
string​ user{​"user"​ + to_string(i)};
 
server.track(user);
 
server.updateLocation(user, anotherLocation);
 
}
 
 
auto​ users = server.usersInBox(aUser, Width, Height);
 
CHECK_EQUAL(lots, users.size());
 
}

When we run our tests, we notice a pause while ...

Get Modern C++ Programming with Test-Driven Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.