Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TS-4331: Major re-write of hostdb #653

Merged
merged 3 commits into from Jun 28, 2016
Merged

Conversation

jacksontj
Copy link
Contributor

@jacksontj jacksontj commented May 20, 2016

This is still a WIP, but I figure it's about time to get some feedback on the code here.

The primary goal of this is to fix the crashing issues described in TS-4331, where basically multicache wasn't keeping track of who referenced various items within the cache.

At this point my TODO list still is:

  • Additional tests
    • tests for syncing/loading cache from disk
  • remove HOST_DB_MAX_ROUND_ROBIN_INFO as a compile time constant-- make it configurable (this will probably get bumped into a separate PR-- since it requires some work down in the dns processor as well).

Nice-to-have:

  • MgmtMarshall for serialization (ideally moving it into lib/ts)

I'm sure more will come up, I'll do my best to keep this list ^^ up-to-date

Note: the plan for this PR is to get something better that works in, I don't want this PR to drag out forever due to scope creep ;) At this point I think we have enough features complete to merge this.

After testing and rolling this change out internally, we see a significant performance improvement even over multicache with no persistance (this is the latency of an in-memory fileserver, Blue is "control-- specifically normal multicache with syncing, Red is this PR, green is "control with no syncing"-- the spikes are the crashes from multicache) :
hostdb_rewrite

@jacksontj jacksontj changed the title TS-4331Major re-write of hostdb TS-4331: Major re-write of hostdb May 20, 2016
@jacksontj jacksontj force-pushed the hostdb_cleanup branch 4 times, most recently from 6d5bb74 to 8df86d6 Compare May 21, 2016 02:37
@zwoop zwoop added the HostDB label May 24, 2016
@zwoop zwoop added this to the 7.0.0 milestone May 24, 2016
int cause_of_death_errno; // in
HostDBInfo host_db_info; // in
int cause_of_death_errno; // in
Ptr<RefCountCacheItem<HostDBInfo>> *hostdb_entry; // Pointer to the entry we are referencing in hostdb-- to keep our ref
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hostdb_entry doesn't need to be allocated, it should be Ptr<RefCountCacheItem<HostDBInfo>>. Consider making a typedef for RefCountCacheItem<HostDBInfo> to reduce the verbosity.

@jacksontj jacksontj force-pushed the hostdb_cleanup branch 4 times, most recently from 0ad71c3 to dcbb672 Compare May 29, 2016 15:20
ats_scoped_str rundir(RecConfigReadRuntimeDir());
ats_scoped_str config(Layout::relative_to(rundir, "hostdb.config"));
// Combine the path and name
char full_path[2 * PATH_NAME_MAX];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Presumably if you really need more than PATH_NAME_MAX it's not going to work anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, TBH I'm not sure why thats like that-- it was before (in a different part of the code-- moved to here. Presumably we actually know what the size is-- since we have the filename and path... I can definitely clean that :)

@SolidWallOfCode
Copy link
Member

The IPv4 and IPv6 addresses are stored in the same hash table because that was easiest at the time. There's certainly no fundamental reason to do that, although maybe it helps with keeping all the addresses for a host entry with both in the same container.

unsigned int num_partitions;

std::string filepath;
std::string dirname;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should not need to store this again here. HostDBSync has a copy and RefCountCacheSync has a copy, we should be able to without this one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, must have missed them in the cleanup ;)

@jacksontj
Copy link
Contributor Author

@jpeach that should cover all but the mac build case (i'll fix that once I'm in the office). So, once the mac builds are working it sounds like we might be ready for a merge.

Note: i will squash these commits before merging, keeping them separate for now to hopefully confuse github less during the review :)

@atsci
Copy link

atsci commented Jun 27, 2016

FreeBSD build successful! See https://ci.trafficserver.apache.org/job/Github-FreeBSD/349/ for details.

@atsci
Copy link

atsci commented Jun 27, 2016

Linux build successful! See https://ci.trafficserver.apache.org/job/Github-Linux/243/ for details.

@atsci
Copy link

atsci commented Jun 27, 2016

Linux build successful! See https://ci.trafficserver.apache.org/job/Github-Linux/255/ for details.

@atsci
Copy link

atsci commented Jun 27, 2016

FreeBSD build successful! See https://ci.trafficserver.apache.org/job/Github-FreeBSD/361/ for details.

@atsci
Copy link

atsci commented Jun 27, 2016

Linux build successful! See https://ci.trafficserver.apache.org/job/Github-Linux/256/ for details.

@atsci
Copy link

atsci commented Jun 27, 2016

FreeBSD build successful! See https://ci.trafficserver.apache.org/job/Github-FreeBSD/362/ for details.

@atsci
Copy link

atsci commented Jun 27, 2016

Linux build successful! See https://ci.trafficserver.apache.org/job/Github-Linux/257/ for details.

@atsci
Copy link

atsci commented Jun 27, 2016

FreeBSD build successful! See https://ci.trafficserver.apache.org/job/Github-FreeBSD/363/ for details.

@atsci
Copy link

atsci commented Jun 27, 2016

Linux build successful! See https://ci.trafficserver.apache.org/job/Github-Linux/258/ for details.

@atsci
Copy link

atsci commented Jun 27, 2016

FreeBSD build successful! See https://ci.trafficserver.apache.org/job/Github-FreeBSD/364/ for details.

@atsci
Copy link

atsci commented Jun 28, 2016

Linux build successful! See https://ci.trafficserver.apache.org/job/Github-Linux/259/ for details.

@jpeach
Copy link
Contributor

jpeach commented Jun 28, 2016

👍

Before doing the rewrite of hostdb (TS-4331) this commit cleans up someo f the method names etc. to make this subsystem less confusing
@jacksontj jacksontj merged commit 53f7579 into apache:master Jun 28, 2016
@atsci
Copy link

atsci commented Jun 28, 2016

FreeBSD build successful! See https://ci.trafficserver.apache.org/job/Github-FreeBSD/365/ for details.

@atsci
Copy link

atsci commented Jun 28, 2016

Linux build successful! See https://ci.trafficserver.apache.org/job/Github-Linux/260/ for details.

masaori335 pushed a commit to masaori335/trafficserver that referenced this pull request Sep 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants