oTree Forum >

Creating session on Heroku takes very long

#1 by elokdae

I am trying to create a session on Heroku with 1000+ participants and it is taking very very long (at the time of writing I am at ~1.5hrs). It is a single player app with 55 rounds. Each player plays against 19 'bots', which I coded using the ExtraModel class following the example here: https://s3.amazonaws.com/otreehub/browsable_source/d7188187-cdba-4c61-ae3a-d7cc3d6fcde9/bots_vs_humans_complex/__init__.py.

Here is my code for creating_session:

class Subsession(BaseSubsession):
    counter = models.IntegerField(initial=1)

    def creating_session(self):
        players = self.get_players()
        for player in players:
            for bot in range(C.BOTS_PER_GROUP):
                MyBot.create(player=player, agent_id=bot + 1)
            
(C.BOTS_PER_GROUP equals 19 in the above.)

Is this expected, and how could it be sped up?

#2 by clintmckenna

How many variables do you have in Player model?

#3 by clintmckenna

Oh, sorry just saw you posted the code. Maybe someone will have better advice, but have you considered trying to make it a single round as a Live Page? I have also used the jspsych integration in oTree to make everything one page, but that would probably be more work.

#4 by elokdae

There are 4 boolean, 8 integer, 4 float and 1 string variables in the player model (in addition to the built in variables). The MyBot ExtraModel class has a similar number of variables.

I did not quite understand how ExtraModel is handled in the documentation, does it require a similar amount of memory as players? In other words, if I have 1000 players, each having 19 ExtraModels, is it like having 20000 players? That could perhaps be the issue.

Write a reply

Set forum username