Over the past year, the market has done quite well as a whole, with the S&P 500 up by nearly 16%. However, the performance hasn't been equally distributed among sectors. Technology, for example, has performed quite strongly -- up 32% in that time. On the other hand, energy has been a laggard, with the sector down 3% over the past 12 months.

Sector

1-Year % Change

Information technology

32.2%

Financials

22.1%

Industrials

19.9%

Consumer discretionary

16.1%

Materials

14.3%

Utilities

10.3%

Consumer staples

8.7%

Healthcare

8.0%

Real estate

1.5%

Energy

(2.9%)

Telecommunication services

(4.4%)

Data source: Fidelity. Real estate has not been an S&P sector for a full year, so its performance is based on the change in the Real Estate Select Sector SPDR ETF.

Because of this broad range of returns, even if your portfolio is diversified, there is one checkup you should be doing periodically that's especially important right now. Here's how to check your portfolio's weighting and how to rebalance it, if necessary.

Have any of your stocks done extraordinarily well? It could be a problem

I've been a big fan of Bank of America (NYSE: BAC) stock for a long time. In fact, I accumulated a big position in the bank in early 2016 when bank stocks took a nosedive, at an average cost of just under $12 per share. Fast-forward to the present time, and the bank's stock price has roughly doubled.

BAC Chart

BAC data by YCharts.

Now, a stock doubling in a little over a year is certainly a good problem to have. However, it is a problem.

Here's why: When I bought Bank of America, the stock represented just over 4% of my portfolio. After the post-election rally, it made up 9% of my account's value at its peak, which is more than I'm comfortable investing in any one stock.

Even worse, I also owned a few other bank stocks that benefited from the rally. My positions in Goldman Sachs, Regions Financial, and Toronto-Dominion Bank have all done well. By April 2017, the banking sector made up nearly one-fourth of my portfolio's value, up from about 10% in February 2016.

GS Chart

GS data by YCharts.

Rocks balanced on a beam.

Image source: Getty Images.

Why it's so important to rebalance your portfolio regularly

The danger in this situation is that my portfolio became far too vulnerable to fluctuations in bank stocks.

Consider this simplified example: Let's say that you own $10,000 worth of stocks in four different sectors (financials, energy, technology, and retail), and that you initially allocate 25% of your stock investments to each. Now let's say that your financial stocks proceed to double over the next year, while your retail stocks get cut in half and the other two stay the same. Here's what this means for your portfolio at the end of the year.

Sector

Initial Investment Value

Value After 1 Year

% of Portfolio

Financials

$2,500

$5,000

44%

Energy

$2,500

$2,500

22%

Technology

$2,500

$2,500

22%

Retail

$2,500

$1,250

11%

Chart and calculations by author.

The total portfolio value after one year is $11,250, a gain of more than 11%. Even though you're sitting on a nice gain, you're now far too vulnerable to the financial sector. If your financial stocks were to get cut in half, it would cost you 22% of your entire portfolio. In comparison, if retail were to double over the following year, you would only experience a gain of 11%.

In this simplified example, it would be a smart idea to sell some of your financial stocks and use the proceeds to add to your retail stocks to rebalance your portfolio. In my real-world portfolio, I ended up exiting my position in Regions Financial and shifting that money to the real estate sector, which has been a laggard recently.

The bottom line is that you don't want to let your portfolio become too dependent on any one stock or sector. Sure, it would be great if that investment continued to rise, but it could be devastating to your account if it were to fall. Therefore, it's a good idea to check whether a similar situation is occurring in your portfolio, especially after certain sectors have performed so much better than others.

Matthew Frankel owns shares of Bank of America, Goldman Sachs, and The Toronto-Dominion Bank. The Motley Fool has no position in any of the stocks mentioned. The Motley Fool has a disclosure policy.