# Feature OP-1260 - Memcache on multiple app server installations

Project: OpenProject
Status: closed
URL: https://community.openproject.org/work_packages/OP-1260

## Planning

| Attribute | Value |
| --- | --- |
| Date |  |
| Priority | Medium |
| Target versions | 3.0.3 |
| Sprint |  |
| Backlog bucket |  |
| Votes |  |
| List |  |
| Roadmap |  |
| Relevance |  |

## OPEN POINTS / FEEDBACK

_No work packages_

## Features and Chunks

_No work packages_

## Bugs and other work packages

_No work packages_

## Technical Details

| Attribute | Value |
| --- | --- |
| Module |  |
| Feature Flag |  |
| Requires doc change | No |
| Enterprise plan |  |

## Details

| Attribute | Value |
| --- | --- |
| Pull preview |  |
| Mockups |  |
| Accessibility | No |

## People

| Attribute | Value |
| --- | --- |
| Assignee |  |
| Accountable |  |
| Product manager |  |
| Feature Lead |  |
| Developers |  |
| Designer |  |
| Ordered by |  |
| Signed off by |  |
| Interest by |  |

## Estimates and progress

| Attribute | Value |
| --- | --- |
| PD (min) |  |
| PD (max) |  |
| Work |  |
| Labor costs |  |

## Description

## Options

### Store sessions in database

  - generate migration, see this [StackOverflow article on how to do this and what happened with it in Rails 4](https://stackoverflow.com/questions/17655744/rails-4-0-rake-dbsessionscreate)
  - provide way to regularly clean up sessions (e.g. cron job)

### Single memcache server

  - not recommended as an outage of this server would result in no user being able to log in

### two memcache servers with failover

  - not sure how to do this. possible problems:
      - who decides when the memcache is offline? all application servers should use the same one, otherwise one request might work for a user and the next one doesn’t
      - all users are logged out if a memcache server fails (this might be acceptable)

### Other session store

There might be another way to store sessions, that’s faster than the database, but also provides high-availability e.g. [redis](https://github.com/roidrage/redis-session-store).

## Conclusion

I’d vote for the database as this is a highly available service we already use. As long as we don’t have performance problems with it, I think it’s the simplest solution although it requires an additional cron job. I think we should keep memcache as default, but offer the database as an alternative for multi-application server setups.

## Open Questions

  - How to determine whether performance of the database as session store is good enough?

## Todo

  - Read <http://guides.rubyonrails.org/action\_controller\_overview.html\#session>
  - Read <http://guides.rubyonrails.org/security.html\#sessions>

**Acceptance criteria**

  - OpenProject is configurable to use database store
  - Adapt AWS/chef-solo cookbooks
  - ITE/QA and Demo MyProject use database store (Production is part of <mention class="mention" data-id="5275" data-type="work_package" data-text="#5275">#5275</mention>)
  - Option to use database store is documented in the installation guide
