Skip to content

Instantly share code, notes, and snippets.

@creeefs
Last active January 8, 2016 22:00
Show Gist options
  • Select an option

  • Save creeefs/e0a65cfbdb7cf1c18c5c to your computer and use it in GitHub Desktop.

Select an option

Save creeefs/e0a65cfbdb7cf1c18c5c to your computer and use it in GitHub Desktop.
2016-01-05 19:04:23,356 [http-bio-8080-exec-1] INFO core.FeedProxyService:291 () - http://www.nhl.com/feed/nhl/league/expandedclubroster.json?teamId=53&auth=MLBAM_Core|1452038663353|cd66f2918378da06146afd70fec272831c95d467
2016-01-05 19:04:23,484 [http-bio-8080-exec-2] INFO log.CommonsJdbcEventLogger:169 () - Opening connection: jdbc:mysql://bdata-nhl-mysql-stats-prod.cgekh9dh1peg.us-east-1.rds.amazonaws.com/nhldb
Login: ***
Password: ***
2016-01-05 19:04:23,540 [http-bio-8080-exec-1] INFO core.FeedProxyService:306 () - http://www.nhl.com/feed/nhl/league/expandedclubroster.json?teamId=53&auth=MLBAM_Core|1452038663353|cd66f2918378da06146afd70fec272831c95d467 : 187
2016-01-05 19:04:24,057 [http-bio-8080-exec-2] INFO log.CommonsJdbcEventLogger:205 () - +++ Connecting: SUCCESS.
2016-01-05 19:04:24,106 [http-bio-8080-exec-2] INFO log.CommonsJdbcEventLogger:148 () - Detected and installed adapter: org.apache.cayenne.dba.mysql.MySQLAdapter
2016-01-05 19:04:24,107 [http-bio-8080-exec-2] INFO log.CommonsJdbcEventLogger:169 () - Opening connection: jdbc:mysql://bdata-nhl-mysql-stats-prod.cgekh9dh1peg.us-east-1.rds.amazonaws.com/nhldb
Login: ***
Password: ***
2016-01-05 19:04:24,172 [http-bio-8080-exec-2] INFO log.CommonsJdbcEventLogger:205 () - +++ Connecting: SUCCESS.
2016-01-05 19:04:24,173 [http-bio-8080-exec-2] INFO log.CommonsJdbcEventLogger:404 () - --- transaction started.
2016-01-05 19:04:24,243 [http-bio-8080-exec-2] INFO log.CommonsJdbcEventLogger:297 () - SELECT t0.ACTIVE, t0.ARENA_ADDRESS, t0.ARENA_ADDRESS2, t0.ARENA_CITY, t0.ARENA_COORDINATES, t0.ARENA_COUNTRY, t0.ARENA_NAME, t0.ARENA_ZIP_POSTAL_CODE, t0.BUY_SELL_TICKET_URL, t0.CONFERENCE_ID, t0.DATE_FOUNDED, t0.DIVISION_ID, t0.FACEBOOK, t0.FAN_EMAIL, t0.FRANCHISE_ID, t0.FULL_NAME, t0.GAMECENTER_MOBILE_APP_TICKET_URL, t0.GAMECENTER_TABLET_APP_TICKET_URL, t0.INSTAGRAM, t0.LEAGUE_ID, t0.MOBILE_APP_TICKET_URL, t0.MOBILE_BUY_SELL_TICKET_URL, t0.MOBILE_TICKET_URL, t0.OFFICIAL_SITE_URL, t0.TABLET_TICKET_URL, t0.TEAM_ABBREV, t0.TEAM_COMMON_NAME, t0.TEAM_ID, t0.TEAM_PLACE_NAME, t0.TICKET_URL, t0.TIMEZONE_ID, t0.TWITTER FROM nhldb.advstats_team t0 WHERE t0.TEAM_ID IN (?) [bind: 1->TEAM_ID:5] - prepared in 45 ms.
2016-01-05 19:04:24,281 [http-bio-8080-exec-2] INFO log.CommonsJdbcEventLogger:378 () - === returned 1 row. - took 85 ms.
2016-01-05 19:04:24,289 [http-bio-8080-exec-2] INFO log.CommonsJdbcEventLogger:409 () - +++ transaction committed.
2016-01-05 19:04:24,331 [http-bio-8080-exec-2] INFO log.CommonsJdbcEventLogger:169 () - Opening connection: jdbc:mysql://bdata-nhl-mysql-stats-prod.cgekh9dh1peg.us-east-1.rds.amazonaws.com/nhldb
Login: ***
Password: ***
2016-01-05 19:04:24,400 [http-bio-8080-exec-2] INFO log.CommonsJdbcEventLogger:205 () - +++ Connecting: SUCCESS.
2016-01-05 19:04:24,400 [http-bio-8080-exec-2] INFO log.CommonsJdbcEventLogger:404 () - --- transaction started.
2016-01-05 19:04:24,410 [http-bio-8080-exec-2] INFO log.CommonsJdbcEventLogger:297 () - SELECT t0.ABBREVIATION, t0.ACTIVE, t0.CONF_ID, t0.DIV_ID, t0.NAME FROM nhldb.division t0 WHERE t0.DIV_ID = ? [bind: 1->DIV_ID:18]
2016-01-05 19:04:24,421 [http-bio-8080-exec-2] INFO log.CommonsJdbcEventLogger:378 () - === returned 1 row. - took 12 ms.
2016-01-05 19:04:24,429 [http-bio-8080-exec-2] INFO log.CommonsJdbcEventLogger:409 () - +++ transaction committed.
2016-01-05 19:04:24,432 [http-bio-8080-exec-2] INFO log.CommonsJdbcEventLogger:169 () - Opening connection: jdbc:mysql://bdata-nhl-mysql-stats-prod.cgekh9dh1peg.us-east-1.rds.amazonaws.com/nhldb
Login: ***
Password: ***
2016-01-05 19:04:24,497 [http-bio-8080-exec-2] INFO log.CommonsJdbcEventLogger:205 () - +++ Connecting: SUCCESS.
2016-01-05 19:04:24,497 [http-bio-8080-exec-2] INFO log.CommonsJdbcEventLogger:404 () - --- transaction started.
2016-01-05 19:04:24,505 [http-bio-8080-exec-2] INFO log.CommonsJdbcEventLogger:297 () - SELECT t0.ABBREVIATION, t0.ACTIVE, t0.CONF_ID, t0.NAME, t0.DEFAULT_COLOR, t0.FANCY_IMAGE_URL, t0.IMAGE_URL, t0.JEWEL_URL, t0.LEAGUE_ID, t0.SHORT_NAME FROM nhldb.conference t0 WHERE t0.CONF_ID = ? [bind: 1->CONF_ID:6]
2016-01-05 19:04:24,515 [http-bio-8080-exec-2] INFO log.CommonsJdbcEventLogger:378 () - === returned 1 row. - took 10 ms.
2016-01-05 19:04:24,522 [http-bio-8080-exec-2] INFO log.CommonsJdbcEventLogger:409 () - +++ transaction committed.
@creeefs

creeefs commented Jan 6, 2016

Copy link
Copy Markdown
Author

cayenne-nhl.xml File

<?xml version="1.0" encoding="utf-8"?>
<domain project-version="7">
    <map name="datamap"/>

    <node name="datanode"
         factory="org.apache.cayenne.configuration.server.XMLPoolingDataSourceFactory"
         schema-update-strategy="org.apache.cayenne.access.dbsync.SkipSchemaUpdateStrategy"
        >
        <map-ref name="datamap"/>
        <data-source>
            <driver value="com.mysql.jdbc.Driver"/>
            <url value="${nhl.db}"/>
            <connectionPool min="${cayenne.connections.min}" max="${cayenne.connections.min}"/>
            <login userName="${nhl.db.username}" password="${nhl.db.password}"/>
        </data-source>
    </node>
</domain>

@creeefs

creeefs commented Jan 6, 2016

Copy link
Copy Markdown
Author

Hey Andrus,

It seems like we haven’t configured Cayenne properly to use a connection pool (see logs above). Looks like we might be opening a new connection per transaction rather than checking out a connection from a pool. Can you provide some guidance on what the best approach would be re: connection pooling with Cayenne? Seems like there are several options including using Cayenne's own connection pool or using Apache's commons-dbcp.

Let me know if you need any additional information.

Thanks,
Chris

@evoytk

evoytk commented Jan 8, 2016

Copy link
Copy Markdown

It may be connected with the above issue, but we also times where the db connection fails to reconnect or we see communication exceptions. Should we add auto reconnect or other connection properties?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment